twilio / twilio-go

A Go package for communicating with the Twilio API.
MIT License
280 stars 40 forks source link

feat: add the ability to post a JSON payload to the Twilio API's #83

Open RJPearson94 opened 3 years ago

RJPearson94 commented 3 years ago

Updating the configuration of a Flex instance requires a POST request to be made with a JSON payload. This change lays the foundations to support this. This is highlighted in https://github.com/twilio/twilio-oai-generator/issues/49

The PostJson accepts an interface for the request body (data) instead of just a map as this prevents the computational overhead of having to marshal the struct to a slice of bytes then create a string from the bytes. The JSON string would then be unmarshalled to a map and then marshalled again to a slice of bytes

This change makes the Content-Type header mandatory for POST requests

Checklist

If you have questions, please file a support ticket, or create a GitHub Issue in this repository.