Open-EO / openeo-backend-validator

Service to validate back-end compliance with the API specification.
Apache License 2.0
1 stars 3 forks source link

strip trailing / from well-known/openeo urls #36

Closed soxofaan closed 4 years ago

soxofaan commented 4 years ago

small issue: when trying out validator on VITO backend, I noticed that the validator requests urls like GET /openeo/1.0//jobs/, GET /openeo/1.0//service_types, GET /openeo/1.0//me, etc (so with double //), which get forwarded to single slash version.

note that the urls in our https://openeo.vito.be/.well-known/openeo contain a trailing slash (as far as I know this is fine):

{"versions":[
    {"api_version":"0.4.2","production":true,"url":"https://openeo.vito.be/openeo/0.4/"},
   {"api_version":"1.0.0","production":false,"url":"https://openeo.vito.be/openeo/1.0/"}
]}

when assembling the endpoint urls you better strip the trailing slash from the base url when possible, I think

m-mohr commented 4 years ago

Indeed the API doesn't say anything about that, but all examples use no trailing slashs. I'm wondering whether that should be clarified. Let me look through the clients and check how the implementations are. If all assume no trailing slash, I'll clarify for 1.0.

m-mohr commented 4 years ago

I'm not exactly sure about R, but JS any Py handle slashes correctly. So I won't clarify in the API and thus this is a bug in the validator ;-)

soxofaan commented 4 years ago

not so minor apparently: it break POST requests

                "jobs_post": {
                    "message": "Input: /jobs; Error: Response Code 500; Details: { 'message': 'b'A request was sent to this URL (http://localhost:8080/openeo/1.0//jobs) but a redirect was issued automatically by the routing system to \\'http://localhost:8080/openeo/1.0/jobs\\'. Make sure to directly send your POST-request to this URL since we can\\\\'t make browsers or HTTP clients redirect with form data reliably or without user interaction.\\\\n\\\\nNote: this exception is only raised in debug mode''}",
                    "state": "Error",
                    "type": "POST",
                    "url": "/jobs"
bgoesswe commented 4 years ago

Fixed in 1ed9951b0978ec3ff12eee90735727ba5745937d, so it will work now either way.

soxofaan commented 4 years ago

confirmed, thanks