fix [BUG] AuthorizeAttribute does not add a header to the request #946 #979
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Other information:
I see two ways of fixing this issue:
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.