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

Inconsistent behavior in fetch service. XH.fetchJson 'POST' request and XH.fetchService.postJson() #3761

Open
oodarluz opened this issue Aug 21, 2024 · 0 comments

Comments

@oodarluz
Copy link

oodarluz commented Aug 21, 2024

Using method:'POST' in XH.fetchJson causes the Content-Type header to be hijacked by the withDefaultsAsync function which replaces it with 'application/x-www-form-urlencoded'. Whereas, the XH.fetchService.postJson() sets the Content-Type to 'application/json'.

Overriding the Content-Type to 'application/x-www-form-urlencoded' can cause unexpected behavior. e.g. when using parseRequestJSON() in a controller expecting the request it will throw as the request input stream is being parsed the wrong way

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

No branches or pull requests

1 participant