Skip to content

Commit

Permalink
Fix #388 Triggering Authenticator double encodes body in POST, PUT, P…
Browse files Browse the repository at this point in the history
…ATCH (#390)

fixes #388
  • Loading branch information
techouse authored Dec 11, 2022
1 parent 2775a73 commit 11a9ca5
Show file tree
Hide file tree
Showing 3 changed files with 422 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chopper/lib/src/base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ class ChopperClient {
ConvertRequest? requestConverter,
ConvertResponse? responseConverter,
}) async {
var req = await _interceptRequest(
final Request req = await _interceptRequest(
await _handleRequestConverter(request, requestConverter),
);

_requestController.add(req);

final streamRes = await httpClient.send(await req.toBaseRequest());
Expand All @@ -307,7 +308,11 @@ class ChopperClient {
dynamic res = Response(response, response.body);

if (authenticator != null) {
var updatedRequest = await authenticator!.authenticate(req, res, request);
final Request? updatedRequest = await authenticator!.authenticate(
request,
res,
request,
);

if (updatedRequest != null) {
res = await send<BodyType, InnerType>(
Expand Down
Loading

0 comments on commit 11a9ca5

Please sign in to comment.