Skip to content
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

Merged
merged 6 commits into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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