-
Notifications
You must be signed in to change notification settings - Fork 236
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
Allow custom headers in request #77
Conversation
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.
Please add one additional test asserting the default behavior: no headers should be sent if requestHeaders
is not set
README.md
Outdated
@@ -13,7 +13,8 @@ const jwksClient = require('jwks-rsa'); | |||
|
|||
const client = jwksClient({ | |||
strictSsl: true, // Default value | |||
jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json' | |||
jwksUri: 'https://sandrino.auth0.com/.well-known/jwks.json', | |||
headers: {} // Optional |
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.
headers: {} // Optional | |
requestHeaders: {} // Optional |
src/JwksClient.js
Outdated
@@ -24,7 +24,7 @@ export class JwksClient { | |||
|
|||
getKeys(cb) { | |||
this.logger(`Fetching keys from '${this.options.jwksUri}'`); | |||
request({ json: true, uri: this.options.jwksUri, strictSSL: this.options.strictSsl }, (err, res) => { | |||
request({ json: true, uri: this.options.jwksUri, strictSSL: this.options.strictSsl, headers: this.options.headers }, (err, res) => { |
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.
request({ json: true, uri: this.options.jwksUri, strictSSL: this.options.strictSsl, headers: this.options.headers }, (err, res) => { | |
request({ json: true, uri: this.options.jwksUri, strictSSL: this.options.strictSsl, headers: this.options.requestHeaders }, (err, res) => { |
tests/jwksClient.tests.js
Outdated
|
||
const client = new JwksClient({ | ||
jwksUri: `${jwksHost}/.well-known/jwks.json`, | ||
headers: { |
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.
headers: { | |
requestHeaders: { |
85514c0
to
e6b75bb
Compare
…nfirming they are sent with the request
Closes #59
Add-on to #64