-
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
Authenticator corrupts request body #388
Comments
Confirmed. I was able to replicate this in a test case. The Authenticator I used is pretty vanilla. class FakeAuthenticator extends Authenticator {
@override
FutureOr<Request?> authenticate(
Request request,
Response response, [
Request? originalRequest,
]) async {
if (response.statusCode == 401) {
return request.copyWith(
headers: <String, String>{
...request.headers,
'authorization': 'some_fake_token',
},
);
}
return null;
}
} This assertion here fails after triggering the Authenticator.
If the Authenticator is not triggered it passes. It also affects @InAnadea Until I hopefully fix this I suggest you pre-authenticate before attempting any POST calls. |
#390 should fix it. @InAnadea can you please check out the PR or https://github.com/techouse/chopper/tree/fix-authenticator-corrupting-body and confirm that it all works? |
Steps to Reproduce
When I added an authenticator for
ChopperClient
, my POST request started giving an HTTP code 400.Just add an authenticator for the client.
I'm debugged
ChopperClient
's code and here afterauthenticator!.authenticate(req, res, request)
body converts to string.Expected results:
The request should save the body type after
request.copyWith
.Actual results:
The authenticator converts the body to string.
Code sample
Logs
The text was updated successfully, but these errors were encountered: