Skip to content

Commit 9e0c636

Browse files
committed
Change react-native plugin to use HTTP POST w/ phony Origin (fixes #493)
1 parent 7fe9a47 commit 9e0c636

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugins/react-native.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ function reactNativePlugin(Raven) {
2727
}
2828

2929
function xhrTransport(options) {
30-
options.auth.sentry_data = JSON.stringify(options.data);
31-
3230
var request = new XMLHttpRequest();
3331
request.onreadystatechange = function (e) {
3432
if (request.readyState !== 4) {
@@ -46,8 +44,12 @@ function reactNativePlugin(Raven) {
4644
}
4745
};
4846

49-
request.open('GET', options.url + '?' + urlencode(options.auth));
50-
request.send();
47+
request.open('POST', options.url + '?' + urlencode(options.auth));
48+
// Sentry expects an Origin header when using HTTP POST w/ public DSN.
49+
// Just set a phony Origin value; only matters if Sentry Project is configured
50+
// to whitelist specific origins.
51+
request.setRequestHeader('Origin', '<React Native>');
52+
request.send(JSON.stringify(options.data));
5153
}
5254

5355
// react-native doesn't have a document, so can't use default Image

0 commit comments

Comments
 (0)