File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -128,3 +128,7 @@ class CommonOptions:
128128
129129 url_prefix : str = ""
130130 """The URL prefix where IDOM resources will be served from"""
131+
132+ def __post_init__ (self ):
133+ if self .url_prefix and not self .url_prefix .startswith ("/" ):
134+ raise ValueError ("Expected 'url_prefix' to start with '/'" )
Original file line number Diff line number Diff line change 11import pytest
22
33from idom import html
4- from idom .backend ._common import traversal_safe_path , vdom_head_elements_to_html
4+ from idom .backend ._common import (
5+ CommonOptions ,
6+ traversal_safe_path ,
7+ vdom_head_elements_to_html ,
8+ )
9+
10+
11+ def test_common_options_url_prefix_starts_with_slash ():
12+ # no prefix specified
13+ CommonOptions (url_prefix = "" )
14+
15+ with pytest .raises (ValueError , match = "start with '/'" ):
16+ CommonOptions (url_prefix = "not-start-withslash" )
517
618
719@pytest .mark .parametrize (
You can’t perform that action at this time.
0 commit comments