Skip to content

Commit 106caa9

Browse files
author
Mike Ng
committed
Add CORS param to prevent browsers from logging cors errors in the console when dispatching events.
1 parent 4defbd8 commit 106caa9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/plugins/event_dispatcher/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ module.exports = {
1111
*/
1212
dispatchEvent: function(url, params) {
1313
return new bluebird(function(resolve, reject) {
14+
// add param for cors headers to be sent by the log endpoint
15+
url += '?wxhr=true';
1416
if (params) {
15-
url += '?' + toQueryString(params);
17+
url += '&' + toQueryString(params);
1618
}
1719

1820
var req = new XMLHttpRequest();

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "optimizely-client-sdk",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Javascript SDK for client testing",
55
"main": "index.js",
66
"scripts": {
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"bluebird": "^3.4.0",
2323
"lodash": "^4.13.1",
24-
"optimizely-server-sdk": "^0.1.1"
24+
"optimizely-server-sdk": "^0.1.2"
2525
},
2626
"devDependencies": {
2727
"chai": "^3.5.0",

0 commit comments

Comments
 (0)