8000 fix [BUG] AuthorizeAttribute does not add a header to the request #946 by BarsikV · Pull Request #979 · reactiveui/refit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix [BUG] AuthorizeAttribute does not add a header to the request #946 #979

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

Merged
merged 2 commits into from
Oct 9, 2020

Conversation

BarsikV
Copy link
Contributor
@BarsikV BarsikV commented Oct 6, 2020

What kind of change does this PR introduce?
This fixes the issue [BUG] AuthorizeAttribute does not add a header to the request #946

What is the current behavior?
In short: currently, the AuthorizeAttribute simply doesn't work.
More in detail: there was an attempt to add an invalid header key, for example "Authorization: Bearer ", and a token as the value. This resulted in nothing being added at all.

What is the new behavior?
Now the AuthorizeAttribute isn't tightly coupled to the headers, but it's a self-contained Attribute instead, which allows us to build the correct Header and value in the RequestBuilderImplementation class.

What might this PR break?
May be something in rest info method could get read incorrectly.
However, I have fixed the query parameters map to ignore the value parameter with the AuthorizeAttribute.

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:
I see two ways of fixing this issue:

  1. Make the AuthorizeAttribute separate from the HeaderAttribute, so it can be handled in its own way.
  2. Rewrite the HeaderAttribute handling logic to allow parsing more complex cases of header keys and values combinations.

I went with the first one, because it looked like the easy way and less chance to introduce bugs.

I have added a new section to the README file, thus I checked the "Docs have been added / updated (for bug fixes / features)". Is there any other docs that should've been updated?

I am open to comments and discussion on how to improve my PR.
Or, if necessary, you can use this PR as inspiration to fix it yourself.

@dnfadmin
Copy link
dnfadmin commented Oct 6, 2020

CLA assistant check
All CLA requirements met.

@jamiehowarth0
Copy link
Member

Thankyou for this PR - that's great work, I'm more than happy to approve this with the test you've written.

@jamiehowarth0 jamiehowarth0 merged commit fb3ebbf into reactiveui:master Oct 9, 2020
@BarsikV
Copy link
Contributor Author
BarsikV commented Oct 12, 2020

Cool! It's my first time contributing in an open source project and my PR got merged, thank you! I am very happy about it :)

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0