## TL;DR

Check whether the response format changed (compression, encoding) before debugging your request. Nothing in the app code changed.

## Steps

1. On the quickbooks-ruby oauth2 branch, every POST to create a customer or
invoice suddenly failed with a weird XML error that just showed
`[?xml version="1.0"?]` as the error message. Nothing in the app code changed.
Sandbox and production both failed.

2. Intuit changed their responses to be gzip-compressed without telling anyone,
and the gem's Faraday connection did not always have the gzip middleware
registered. The raw compressed response was parsed as XML and blew up with the
cryptic error.

3. Update quickbooks-ruby to a version that includes the gzip fix on the oauth2
branch (the fix: always rebuild the Faraday connection with gzip support).

4. Register gzip explicitly when building the OAuth2 client: pass a block to
`OAuth2::Client.new` that does `builder.use :gzip`, `builder.request
:url_encoded`, and sets the adapter.

5. A cryptic parse error that appears overnight with no code change, hitting
sandbox and production at once, is usually a provider-side change, not your
bug. Check whether the response format changed (compression, encoding) before
debugging your request.

## When to use

You are seeing this: On the quickbooks-ruby oauth2 branch, every POST to create a customer or invoice suddenly failed with a weird XML error that just showed [?xml version="1.0"?] as the error message. Use this skill when you run into "quickbooks-ruby fails creating customers/invoices with a bare XML version error".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 1.0. If you are on something much newer or older, the details may have shifted.

## Why this happens

Intuit changed their responses to be gzip-compressed without telling anyone, and the gem's Faraday connection did not always have the gzip middleware registered.
