hoist-react
hoist-react copied to clipboard
Inconsistent behavior in fetch service. XH.fetchJson 'POST' request and XH.fetchService.postJson()
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