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

fix(POST /api/file): REST API endpoint returns json content-type #3463

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

iainsproat
Copy link
Contributor

@iainsproat iainsproat commented Nov 8, 2024

Description & motivation

Calls to POST /api/file/:fileType/:streamId/:branchName? returned an incorrect content-type header in its response.
The application/json content-type is now returned.

Changes:

  • Content-Type header of POST /api/file/:fileType/:streamId/:branchName? endpoint is application/json
  • tests assert the contents in the body of responses to POST /api/file/:fileType/:streamId/:branchName?.
  • error responses to POST /api/file/:fileType/:streamId/:branchName? are valid json

To-do before merge:

Screenshots:

Validation of changes:

Checklist:

  • My pull request follows the guidelines in the Contributing guide?
  • My pull request does not duplicate any other open Pull Requests for the same update/change?
  • My commits are related to the pull request and do not amend unrelated code or documentation.
  • My code follows a similar style to existing code.
  • I have added appropriate tests.
  • I have updated or added relevant documentation.

References

Copy link

linear bot commented Nov 8, 2024

@iainsproat iainsproat marked this pull request as ready for review November 20, 2024 10:08
@iainsproat iainsproat requested a review from fabis94 November 20, 2024 15:01
Copy link
Contributor

@fabis94 fabis94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC the content type is already JSON, just the headers were not set correclty, right? if so, the frontend already treats it as JSON (and it does look that way)

@iainsproat
Copy link
Contributor Author

IIRC the content type is already JSON, just the headers were not set correclty, right? if so, the frontend already treats it as JSON (and it does look that way)

Yes, it was returning JSON in the body but the headers were not correct. Thanks for confirming the frontend behaviour @fabis94

@iainsproat iainsproat merged commit 35eb209 into main Jan 2, 2025
26 of 28 checks passed
@iainsproat iainsproat deleted the iain/web-2065-wrong-content-type-in-http-response branch January 2, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants