-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
feat: add header option (#47) #52
Conversation
Could you please add a test for this as well https://github.com/fastify/fastify-basic-auth/blob/master/index.test-d.ts? |
1d11227
to
52f9434
Compare
Added an optional header to one of the existing tests, does that cover us? |
```js | ||
fastify.register(require('fastify-basic-auth'), { | ||
validate, | ||
header: 'x-forwarded-authorization' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we mention that it must be lowercase or add a lowercase function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it must be lowercased?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise the lookup of the header will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the .toLowerCase()
suggestion from @mcollina. Will update the test to reflect this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the test to demonstrate the to lowercasing. Not sure it needs a whole test of it's own but let me know if that's not enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also need an added test
0ab3580
to
0b4f90c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Allow for a 'header' property to be specified in the options object. If present use the value specified as the name of the header from which to extract credentials for validation.
0b4f90c
to
4303901
Compare
Checklist
npm run test
andnpm run benchmark
and the Code of conduct