Add headers param to API calls, auto-detect JSON for encoding to raw data, prevent exceptions caused by logging non UTF-8 data #39
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using endpoints like
POST /api/v2/uploads.jsonwhere binary data is transferred in the request body, we need to extend the abstract class to allow for such non-JSON data. We also need a means for setting the content-type associated with the transfer, which this update provides.For backwards compatibility, these additions will fall back to their previous implementation (JSON-specific) when not used.
As a side-effect, this caused logging errors because of non UTF-8 characters in the request body. So that also needed to be accounted for.
With this update, it's now possible to use the attachments resource in the following way:
Ref: https://developer.zendesk.com/rest_api/docs/core/attachments#uploading-files