When using your library on a website, every usages of navigator.sendBeacon(url, formData) are broken.
It seems that your library is patching the FormData object. It works fine with fetch and xhr because it is also patching them. But it is still an issue with sendBeacon: the browser is receiving an unexpected Xhook instance and because it does not recognize it, just runs toString on the provided value which produces "[object Object]".
How to reproduce:
- With
xhook installed on a HTML document, run something like this:
const formData = new FormData()
formData.append("foo", "bar")
navigator.sendBeacon("/", formData)
- Look at the request payload in the devtools:
- Actual:

- Expected:

When using your library on a website, every usages of
navigator.sendBeacon(url, formData)are broken.It seems that your library is patching the
FormDataobject. It works fine withfetchandxhrbecause it is also patching them. But it is still an issue withsendBeacon: the browser is receiving an unexpectedXhookinstance and because it does not recognize it, just runstoStringon the provided value which produces"[object Object]".How to reproduce:
xhookinstalled on a HTML document, run something like this: