@@ -131,15 +131,15 @@ def __init__(self, src, dst):
131
131
132
132
if dst not in CRS_LIST .keys ():
133
133
raise HTTPException (
134
- status_code = status .HTTP_400_BAD_REQUEST ,
134
+ status_code = status .HTTP_400_BAD_REQUEST ,
135
135
detail = f"Unknown destination CRS identifier: '{ dst } '" ,
136
136
)
137
137
138
138
src_region = CRS_LIST [src ]["country" ]
139
139
dst_region = CRS_LIST [dst ]["country" ]
140
140
if src_region != dst_region and "Global" not in (src_region , dst_region ):
141
141
raise HTTPException (
142
- status_code = status .HTTP_400_BAD_REQUEST ,
142
+ status_code = status .HTTP_400_BAD_REQUEST ,
143
143
detail = "CRS's are not compatible across countries" ,
144
144
)
145
145
@@ -302,12 +302,17 @@ class WEBPROJInfo(BaseModel):
302
302
proj_version : str
303
303
304
304
305
- # Set up API entry-points
306
-
305
+ # Set up API entry-points. Note that some entry-points are duplicated without the trailing /.
306
+ # We do this to circumvent implicit redirects made by uvicorn (?) that results
307
+ # in URL's that can't be resolved. We do not include those entry-points in the schema.
308
+ # It may be possible to do this in a cleaner way by configuring uvicorn differently...
307
309
308
310
@app .get ("/v1.0/crs/" )
311
+ @app .get ("/v1.0/crs" , include_in_schema = False )
309
312
@app .get ("/v1.1/crs/" )
313
+ @app .get ("/v1.1/crs" , include_in_schema = False )
310
314
@app .get ("/v1.2/crs/" )
315
+ @app .get ("/v1.2/crs" , include_in_schema = False )
311
316
def crs_index () -> CRSList :
312
317
"""
313
318
List available coordinate reference systems
@@ -505,6 +510,7 @@ async def transformation_4d(
505
510
506
511
507
512
@app .get ("/v1.2/info/" )
513
+ @app .get ("/v1.2/info" , include_in_schema = False )
508
514
async def info () -> WEBPROJInfo :
509
515
"""
510
516
Retrieve information about the running instance of WEBPROJ and it's constituent components.
0 commit comments