fix: omit JSON bodies on GET requests

Draft
KA
4d ago
+101-4

Read-only SDK methods currently construct requests with params={}; both request implementations forward that as json={}. Consequently, Requests and HTTPX encode a JSON body and Content-Type on GET requests such as Emails.get() and Emails.list(), including paginated reads whose parameters are already in the URL.

Pass no JSON body for GET, preserving existing JSON serialization for writes. This aligns read requests with the API specification and other SDKs and avoids unnecessary GET payloads. This report does not claim a production Resend request currently fails because of the body.

Validation:

  • Eight public API wire-encoding cases inspect actual Requests PreparedRequest and HTTPX Request objects. Six GET cases fail before; two POST controls pass. All eight pass afterward, preserving pagination, auth headers, and POST JSON.
  • Full pytest suite with coverage/doctests: 859 passed, 10 warnings; 98% coverage. No network calls or emails were sent by tests; Requests transport/HTTPX MockTransport return controlled responses.
  • Full source Flake8, changed-source mypy, changed import sorting, new-test Black formatting, package wheel/sdist build, and git diff --check pass.

References:


Summary by cubic

Stops GET requests from sending a JSON body or Content-Type header, aligning read calls like Emails.get() and Emails.list() with the API specification and other SDKs. POST writes keep their existing JSON serialization.

  • GET requests previously forwarded params={} as json={}, so Requests and HTTPX encoded an empty JSON payload on every read.
  • Adds sync and async tests verifying GET bodies are empty while POST payloads remain intact.