-
Notifications
You must be signed in to change notification settings - Fork 122
Description
On the following lines of code, content-type is set in the http client's _header field during json requests. This causes subsequent requests to break if they rely on a different content-type. For instance, if you call create_application (json data) followed by update_number (form data) using the same Vonage client, it appears to force it to use application/json for the update number call, causing a 420 error.
Expected Behavior
The content-type header should be set only for the currently running request
Current Behavior
The content-type header appears to be sticky, and forces incorrect headers on subsequent requests.
Possible Solution
Steps to Reproduce (for bugs)
- Initialize the vonage client and attempt to use it for 2 requests with different content-types (example:
create_applicationthenupdate_number)
Context
We were debugging an issue with a project that was throwing 420s and was difficult to reproduce. Postman requests, curl requests, etc all worked, but our app failed. The issue was we call a few endpoints in a row when a number is being assigned. Currently we worked around this by re-initializing the client each time.
Your Environment
- Version used: 4.5, 4.4