Skip to content

fix: keep JSON content type local to each request - #365

Open
Shubham-Padkonde wants to merge 1 commit into
Vonage:mainfrom
Shubham-Padkonde:fix/request-local-content-type
Open

Shubham-Padkonde wants to merge 1 commit into
Vonage:mainfrom
Shubham-Padkonde:fix/request-local-content-type

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes #323.

A JSON request currently writes Content-Type: application/json into the client's shared headers. Reusing that client for a form request sends URL-encoded data with the JSON content type, which can cause the reported 420 response when creating an application and then updating a number.

Copy the default headers into each request and set the JSON content type on that copy. Requests can then supply the correct form content type, and query-only requests no longer inherit a JSON content type. Regression tests exercise JSON followed by form/query requests and verify authentication and default headers are preserved.

Validation: all 62 HTTP-client, Application, and Number Management tests pass on Python 3.13. Both new regressions fail before the fix. Black and git diff --check pass. The separate JWT package suite has two existing invalid-key fixture failures in this environment; that package is unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request content-type persistence causes 420 error on some requests

1 participant