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

PLU-370: [CUSTOM-API-FIX-2] do not overwrite Content-Type #823

Merged

Conversation

kevinkim-ogp
Copy link
Contributor

@kevinkim-ogp kevinkim-ogp commented Dec 18, 2024

TL;DR

Updated Custom API header handling to ensure:

  • Content-Type = application/json, if not set by user
  • Content-Type set in Connection step is not overwritten by Content-Type set in Custom Headers

What changed?

  • Content-Type header is now set for all requests to application/json instead of Axios' default application/x-www-form-urlencoded

How to test?

  1. Make a request to the custom API endpoint with no Content-Type set
  2. Verify that the Content-Type header is present and is application/json
  3. Create a Connection in Add connection step with a custom Content-Type
  4. Verify that the Content-Type header is present and matches what was set
  5. Add a different Content-Type to Custom header step
  6. Verify that it does not overwrite the Content-Type set in the Add connection step

Why make this change?

The Content-Type header should be set consistently for all requests. The previous implementation only set it for requests with headers specified in the Connection step.

Copy link
Contributor Author

kevinkim-ogp commented Dec 18, 2024

@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Dec 18, 2024

Datadog Report

Branch report: fix/custom-api/do-not-overwrite-content-type
Commit report: 6992e34
Test service: plumber

✅ 0 Failed, 722 Passed, 0 Skipped, 2m 13.08s Total Time
⬆️ Test Sessions change in coverage: 1 increased (+0.04%)

@kevinkim-ogp kevinkim-ogp changed the title fix: do not overwrite content-type if set PLU-392: [CUSTOM-API-FIX-2] do not overwrite Content-Type Dec 18, 2024
Copy link

linear bot commented Dec 18, 2024

@kevinkim-ogp kevinkim-ogp marked this pull request as ready for review December 18, 2024 01:37
@kevinkim-ogp kevinkim-ogp requested a review from a team as a code owner December 18, 2024 01:37
@kevinkim-ogp kevinkim-ogp changed the title PLU-392: [CUSTOM-API-FIX-2] do not overwrite Content-Type PLU-370: [CUSTOM-API-FIX-2] do not overwrite Content-Type Dec 18, 2024
Copy link

linear bot commented Dec 18, 2024

Copy link
Contributor

@m0nggh m0nggh left a comment

Choose a reason for hiding this comment

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

lgtm tested that fix works thks

Copy link
Contributor

pregnantboy commented Dec 23, 2024

Merge activity

  • Dec 23, 2:50 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 23, 2:55 AM EST: Graphite couldn't merge this PR because it had conflicts with the trunk branch.
  • Dec 24, 1:11 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 24, 1:12 AM EST: A user merged this pull request with Graphite.

@pregnantboy pregnantboy changed the base branch from fix/custom-api/escape-variable to graphite-base/823 December 23, 2024 07:50
@pregnantboy pregnantboy changed the base branch from graphite-base/823 to develop-v2 December 23, 2024 07:54
@pregnantboy pregnantboy force-pushed the fix/custom-api/do-not-overwrite-content-type branch from 6992e34 to f9ccec2 Compare December 24, 2024 06:11
@pregnantboy pregnantboy merged commit 10d891d into develop-v2 Dec 24, 2024
3 checks passed
@pregnantboy pregnantboy deleted the fix/custom-api/do-not-overwrite-content-type branch December 24, 2024 06:12
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.

3 participants