Skip to content

Commit b1b7c59

Browse files
committed
Merge pull request #527 from getsentry/react-native-json
Add Content-type: application/json for React Native transport
2 parents 830eb04 + bdc68d8 commit b1b7c59

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugins/react-native.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ function reactNativePlugin(Raven) {
4545
};
4646

4747
request.open('POST', options.url + '?' + urlencode(options.auth));
48+
49+
// NOTE: React Native ignores CORS and will NOT send a preflight
50+
// request for application/json.
51+
// See: https://facebook.github.io/react-native/docs/network.html#xmlhttprequest
52+
request.setRequestHeader('Content-type', 'application/json');
53+
4854
// Sentry expects an Origin header when using HTTP POST w/ public DSN.
4955
// Just set a phony Origin value; only matters if Sentry Project is configured
5056
// to whitelist specific origins.

0 commit comments

Comments
 (0)