Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unsupported /files endpoint returns a 404 instead of a 501 #263

Open
bossie opened this issue Feb 22, 2024 · 2 comments
Open

unsupported /files endpoint returns a 404 instead of a 501 #263

bossie opened this issue Feb 22, 2024 · 2 comments

Comments

@bossie
Copy link
Collaborator

bossie commented Feb 22, 2024

A user tried to upload a file with the Python client but this feature is not supported by the back-end and he got a 404 back:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 1488, in upload_file
    resp = self.put(f"/files/{target!s}", expected_status=200, data=f)
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 259, in put
    return self.request("put", path=path, data=data, headers=headers, allow_redirects=False, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 769, in request
    return _request()
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 762, in _request
    return super(Connection, self).request(
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 168, in request
    self._raise_api_error(resp)
  File "/usr/local/lib/python3.9/site-packages/openeo/rest/connection.py", line 188, in _raise_api_error
    raise OpenEoApiError(
openeo.rest.OpenEoApiError: [404] NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. (ref: r-2402229ec6924eceb2e402f908d9cd18)

This should have returned a 501 with code FeatureUnsupported instead.

@soxofaan
Copy link
Member

related issue to catch this earlier at python client level: Open-EO/openeo-python-client#540

also, to cite from openEO API spec:

501 Not Implemented: The requested endpoint is specified by the openEO API, but is not implemented (yet) by the back-end. Note: Unsupported endpoints MAY also return HTTP status code 404.

so openEO API permits returning a 404 actually

@bossie
Copy link
Collaborator Author

bossie commented Feb 23, 2024

so openEO API permits returning a 404 actually

Quite right! I'll file this under enhancement then.

@bossie bossie added enhancement and removed bug labels Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants