-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PLAT-9731] Fix XHR delivery postReportCallback #1938
Conversation
latest changes to the xhr mocks are a bit more sweeping, but a lot more similar to the real thing |
@@ -11,14 +11,18 @@ module.exports = (client, win = window) => ({ | |||
if (req.readyState === win.XMLHttpRequest.DONE) { | |||
const status = req.status | |||
if (status === 0 || status >= 400) { | |||
client._logger.error('Event failed to send…') | |||
const err = new Error(`Request failed with status ${status}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe worth applying this to sendSession
as well — it doesn't look like we currently use/expose the cb
parameter there but if that changes in the future then it'd be nice for it to not have the same bug
Goal
To ensure delivery errors are passed to the post report callback when using the
delivery-xml-http-request
pluginDesign
Follow the same implementation as
delivery-x-domain-request
Testing
Added new unit test and update existing test to verify errors are handled correctly