Skip to content

Commit

Permalink
add root_path to available_api_versions urls (#471)
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek authored Jun 9, 2023
1 parent e827546 commit c1f5a73
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion aiida_optimade/routers/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ def get_info(request: Request):
parse_result = urllib.parse.urlparse(str(request.url))
base_url = get_base_url(parse_result)

root_path_str = ""
if CONFIG.root_path:
root_path_str = f"/{CONFIG.root_path.strip('/')}"

return InfoResponse(
meta=meta_values(
str(request.url), 1, 1, more_data_available=False, schema=CONFIG.schema_url
Expand All @@ -41,7 +45,7 @@ def get_info(request: Request):
api_version=__api_version__,
available_api_versions=[
{
"url": f"{base_url}/v{__api_version__.split('-')[0].split('+')[0].split('.')[0]}",
"url": f"{base_url}{root_path_str}/v{__api_version__.split('-')[0].split('+')[0].split('.')[0]}",
"version": __api_version__,
}
],
Expand Down

0 comments on commit c1f5a73

Please sign in to comment.