ex_force
ex_force copied to clipboard
Add support for the new Tesla version
We updated the Tesla on our project to 1.6, and apparently this operation broke the ExForce dependency. We started to receive a decode error when executing the function ExForce.OAuth.get_token/2
:
Tried with the version 1.5 as well and didn't worked. Tesla 1.4 worked as expected.
Apparently the problem is with some change made in Tesla after the version 1.5.0
.
This is because ex_force
has gzip compression turned on, but when you send a accept-encoding
with gzip to salesforce, the response does not contain a content-encoding
header field required to trigger Tesla's Compression middleware, even though response body is indeed gzip compressed.
Heyy, I work with @LeoLeiteSC and we have some updates about this issue.
The problem here is the ex_force
defines the Tesla.Middleware.Compression
BEFORE the JSON
middleware, but it need to be defined AFTER, to follow this behavior:
- for the request, it first serializes as JSON and then compress the body
- for the response, it decompress the body and then deserializes as JSON
Currently, it's doing the inverse.