Skip to content

Commit 5e09637

Browse files
committed
cleanup and ensures we don't sent the header key in the body of the request
1 parent cf0d072 commit 5e09637

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

dist/hellotext.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/hellotext.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,17 @@ var Hellotext = /*#__PURE__*/function () {
7979
if (this.notInitialized) {
8080
throw new _errors.NotInitializedError();
8181
}
82+
var headers = _objectSpread(_objectSpread({}, params && params.headers || {}), this.headers);
83+
var body = _objectSpread(_objectSpread({
84+
session: this.session,
85+
action
86+
}, params), {}, {
87+
url: params && params.url || window.location.href
88+
});
89+
delete body.headers;
8290
return yield _api.default.events.create({
83-
headers: _objectSpread(_objectSpread({}, params && params.headers || {}), this.headers),
84-
body: _objectSpread(_objectSpread({
85-
session: this.session,
86-
action
87-
}, params), {}, {
88-
url: params && params.url || window.location.href
89-
})
91+
headers,
92+
body
9093
});
9194
});
9295
function track(_x) {

src/hellotext.js

+16-10
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,23 @@ class Hellotext {
6161
throw new NotInitializedError()
6262
}
6363

64+
const headers = {
65+
...(params && params.headers) || {},
66+
...this.headers,
67+
}
68+
69+
const body = {
70+
session: this.session,
71+
action,
72+
...params,
73+
url: (params && params.url) || window.location.href,
74+
}
75+
76+
delete body.headers
77+
6478
return await API.events.create({
65-
headers: {
66-
...(params && params.headers || {}),
67-
...this.headers,
68-
},
69-
body: {
70-
session: this.session,
71-
action,
72-
...params,
73-
url: (params && params.url) || window.location.href,
74-
},
79+
headers,
80+
body,
7581
})
7682
}
7783

0 commit comments

Comments
 (0)