SciCatProject / SciCatProject/backend
HTTP GET on non-existing proposal returns empty content
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 37
- Avg merge
- 17h 32m
- Merged PRs (30d)
- 38
Description
Summary
Using the REST API to get a non-existing proposal through /api/v3/proposals/{pid} returns with HTTP status code 200 and empty content.
From an interactive Python session:
>>> res = client._session.get(f'{client.baseurl}/proposals/does_not_exist')
>>> res.url
'https://scicat-backend-dev.desy.de/api/v3/proposals/does_not_exist'
>>> res.status_code
200
>>> res.content
b''
As a workaround, I am checking for empty content to determine, if the proposal already exists. Using the HTTP status code would be preferred.
Steps to Reproduce
- Authenticate as
proposalIngestorthrough the API - Call
/api/v3/proposals/{pid}, where{pid}refers to a non-existing proposal - Receive HTTP status code 200 and empty response
Current Behaviour
API call returns HTTP status code 200 and empty content in the response
Expected Behaviour
API should return HTTP status code 404 not found.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the REST endpoint handling GET /api/v3/proposals/{pid} and reproduce the request for a non-existing proposal as proposalIngestor. Trace how the empty response is produced and verify that the missing proposal returns HTTP 404 rather than 200 with empty content. Done means the expected status is returned consistently, with a regression test if the project has endpoint tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100