-
-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add per-request http options helper function configuration
This allows every request's [got](https://github.com/sindresorhus/got/tree/v9.6.0) options to be changed on a per-request basis. BREAKING CHANGE: logoutPendingSource no longer receives a `timeout` argument BREAKING CHANGE: `provider.defaultHttpOptions` setter was removed, use the new `httpOptions` configuration helper function instead BREAKING CHANGE: provider now asserts that client's `backchannel_logout_uri` returns a 200 OK response as per specification.
- Loading branch information
Showing
21 changed files
with
176 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const got = require('got'); | ||
const { defaultsDeep } = require('lodash'); | ||
|
||
const pkg = require('../../package.json'); | ||
|
||
const { httpOptions } = require('./defaults'); | ||
const instance = require('./weak_cache'); | ||
|
||
const USER_AGENT = `${pkg.name}/${pkg.version} (${pkg.homepage})`; | ||
|
||
const DEFAULT_HTTP_OPTIONS = { | ||
followRedirect: false, | ||
headers: { 'User-Agent': USER_AGENT }, | ||
retry: 0, | ||
throwHttpErrors: false, | ||
timeout: 2500, | ||
}; | ||
|
||
module.exports = async function request(options) { | ||
const optsFn = instance(this).configuration('httpOptions'); | ||
|
||
let opts = defaultsDeep(options, DEFAULT_HTTP_OPTIONS); | ||
if (optsFn !== httpOptions) { | ||
opts = optsFn(opts); | ||
} | ||
|
||
return got(opts); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.