-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #388 Triggering Authenticator double encodes body in POST, PUT, PATCH #390
Fix #388 Triggering Authenticator double encodes body in POST, PUT, PATCH #390
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's so cool you've added tests! <3 Thank you!
Yeah, I was only able to replicate the issues with tests. After confirming the issue with tests I proceeded to fix it. TDD I guess 🙈 |
Should I merge it or you will? :) |
You're the merge master 😎 |
@JEuler when are we getting this fix to |
Hm, let me prepare PR tomorrow. :) |
What do you think about the version? |
Probably v5.2.0 |
Okay, I will do it today. :) |
This fixes #388
When
ChopperClient
is configured with anAuthenticator
and whenAuthenticator.authenticate
returns a non-null value,ChopperClient.send
recursively passes an already convertedRequest
toChopperClient.send
again. This results in double-encoded JSON.As previously mentioned, the issue only manifests itself when
Authenticator.authenticate
returns a non-null value, in essence when the client receives anHTTP ERROR: 401
. It works perfectly fine when the client is authenticated and/or the Auth token hasn't expired. That's why it probably flew under the radar for so long.This PR fixes it by passing the original
Request
toChopperClient.send
in that case.