Modified starlette test client initialization to not receive a base URL (#1447)

This commit is contained in:
Ricardo Garcia Silva
2023-12-20 16:07:28 +00:00
committed by GitHub
parent 07b40a4305
commit b78d28bcfd
+2 -3
View File
@@ -162,15 +162,14 @@ def mock_starlette(config_file: str = 'pygeoapi-test-config.yml',
reload(starlette_app)
# Get server root path
base_url = starlette_app.CONFIG['server']['url'].rstrip('/')
root_path = urlsplit(base_url).path.rstrip('/') or ''
public_base_url = starlette_app.CONFIG['server']['url'].rstrip('/')
root_path = urlsplit(public_base_url).path.rstrip('/') or ''
# Create and return test client
# Note: setting the 'root_path' does NOT really work and
# does not have the same effect as Flask's APPLICATION_ROOT
client = StarletteClient(
starlette_app.APP,
base_url,
root_path=root_path,
**kwargs
)