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

chopper base.dart send() authenticate sending wrong request #492

Closed
ssierputowski11 opened this issue Aug 25, 2023 · 5 comments · Fixed by #497
Closed

chopper base.dart send() authenticate sending wrong request #492

ssierputowski11 opened this issue Aug 25, 2023 · 5 comments · Fixed by #497
Assignees
Labels
bug Something isn't working

Comments

@ssierputowski11
Copy link

ssierputowski11 commented Aug 25, 2023

See 5.1.0 to see the authenticate is using the req object.

See 5.2.0 and authenticate is using request object

See latest and similar result as above.

Is this by design? I saw another issue #308 that brings this up as well. I used that fix locally and it solved it as well.

Could this be addressed if it is a bug?

@ssierputowski11 ssierputowski11 added the bug Something isn't working label Aug 25, 2023
@ssierputowski11 ssierputowski11 changed the title chopper base.dart send authenticate sending wrong request chopper base.dart send() authenticate sending wrong request Aug 25, 2023
@techouse techouse added the investigation The issue needs further investigation label Aug 26, 2023
@techouse techouse self-assigned this Aug 26, 2023
@techouse
Copy link
Collaborator

techouse commented Aug 26, 2023

Is this by design?

This used to be a bug #388 that I fixed in #390.

Could this be addressed if it is a bug?

I'm not sure. Can you explain the issue you're actually facing?

@techouse techouse added question Further information is requested and removed bug Something isn't working labels Aug 26, 2023
@ssierputowski11
Copy link
Author

I'm not sure. Can you explain the issue you're actually facing?

Yes the authenticate call is not passing in the intercepted request.

Original: final Request? updatedRequest = await authenticator!.authenticate( request, res, request, );

We could potentially have something wrong but that request object is passed through twice. Changing this value to final Request? updatedRequest = await authenticator!.authenticate( req, res, request, ); fixes the issue that I am having. The issue being the request object does not have Header information but the req does contain the Header information

@techouse
Copy link
Collaborator

techouse commented Sep 1, 2023

The issue being the request object does not have Header information but the req does contain the Header information

I see. Thank's for the input!

Can you please try out the changes I have made in the PR #497. Add this to your pubspec.yaml to install chopper from the PR:

dependency_overrides:
  chopper:
    git:
      url: https://github.com/techouse/chopper.git
      ref: fix/492-authenticator-req-request
      path: chopper

In this PR I've re-implemented the fix of #390 by checking if the request.body is already a JSON encoded String before attempting to json.encode it.

@techouse techouse added bug Something isn't working and removed question Further information is requested investigation The issue needs further investigation labels Sep 1, 2023
@ssierputowski11
Copy link
Author

Looks to be reauthenticating properly and the Headers are being passed back to our override functions. Thanks! I'll keep an eye out on the updates and get this implemented when it gets updated

@techouse
Copy link
Collaborator

techouse commented Sep 1, 2023

when it gets updated

@ssierputowski11 v7.0.6 just landed on pub.dev :)

@techouse techouse closed this as completed Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants