You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GET requests send data: {}, which fetch-based runtimes reject #850
SDK you're using: xero-node 20.0.0 (same in 10.2.0 through 19.3.0), axios 1.19.0, Cloudflare Workers
Describe the bug
Every generated GET method (e.g. AccountingApi.getContact, getContacts, getInvoices) builds its request options with data: {}. axios serializes that to a "{}" body. Node's http adapter tolerates it, but on runtimes where axios uses its fetch adapter (Cloudflare Workers, and anywhere Request follows the Fetch spec), creating the Request throws:
TypeError: Request with a GET or HEAD method cannot have a body.
So no GET call works on Workers, even after the token request succeeds.
Expected behavior
Requests without a body parameter omit data (or set it to undefined).
Workaround
Replace the default authentication hook, which runs on each request just before axios sends it:
Activity