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

Allow custom headers in request #77

Merged
merged 2 commits into from
Feb 7, 2019
Merged

Conversation

O-Mutt
Copy link
Member

@O-Mutt O-Mutt commented Feb 1, 2019

Closes #59

Add-on to #64

Copy link
Contributor

@lbalmaceda lbalmaceda left a 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
headers: {} // Optional
requestHeaders: {} // Optional

@@ -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) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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) => {


const client = new JwksClient({
jwksUri: `${jwksHost}/.well-known/jwks.json`,
headers: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
headers: {
requestHeaders: {

@O-Mutt O-Mutt force-pushed the customHeaders branch 2 times, most recently from 85514c0 to e6b75bb Compare February 7, 2019 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants