Fix silent failure on missing Content-Type header (#622) #675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change(s)
Change Type: Fixed
Change Category: Interface
Changelog Entry: Fixed an issue where
POSTandPUTrequests missing theContent-Type: application/jsonheader would silently succeed (returning200 OK) with an empty body instead of failing. These requests now correctly return415 Unsupported Media Type.How to Test
The fix can be verified by sending a request to any resource endpoint (e.g.,
/datasets) with a body but without theContent-Typeheader.Verification Steps:
docker compose up --buildTestClientwith dependency overrides to bypass authentication) that sends aPUTorPOSTrequest with a valid body string but no content-type header.415(previously it was200with no action taken).I verified this locally using a standalone script inside the Docker container that mocked the user authentication dependency to isolate the header check logic.
Checklist
Related Issues
Closes #622