-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat: support for sendBeacon requests #651
base: main
Are you sure you want to change the base?
feat: support for sendBeacon requests #651
Conversation
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.
Thanks for submitting the PR! I only have a few comments.
lib/interceptor.js
Outdated
if (data instanceof Blob) { | ||
return data.text().then(function (payload) { | ||
return interceptSendBeacon(url, payload); | ||
}); | ||
} |
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.
Should we handle the other non-string kinds? (MDN suggests ArrayBuffer
, TypedArray
, DataView
, FormData
, pojos, URLSearchParams
)
If we don't explicitly handle them, it would be good to at least verify what users will see in their spec files for those types.
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.
will try to find some time in the near future to add the other types too
make sure that `if (!sent)` properly triggers for Blob payloads.
Addition of support for intercepting sendBeacon request queueing in response to issue #640
Additionally, some code formatting fixes were auto applied from prettier that is used as pre-push hook