ex_force icon indicating copy to clipboard operation
ex_force copied to clipboard

Add support for the new Tesla version

Open LeoLeiteSC opened this issue 1 year ago • 2 comments

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:

image

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.

LeoLeiteSC avatar May 12 '23 16:05 LeoLeiteSC

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.

roylez avatar May 18 '23 22:05 roylez

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.

jotaviobiondo avatar Dec 12 '23 16:12 jotaviobiondo