Skip to content

Commit

Permalink
refactor: remove request/request http client handling and methods
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Due to request's maintenance mode and inevitable
deprecation (see request/request#3142)
the option to switch the provider to use request has been removed.
  • Loading branch information
panva committed Apr 7, 2019
1 parent 9771581 commit 683e6c2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 104 deletions.
15 changes: 3 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,19 +519,10 @@ property.


## HTTP Request Library / Proxy settings
By default oidc-provider uses the [got][got-library] module. Because of its lightweight nature of
oidc-provider uses the [got][got-library] module. Because of its lightweight nature of
the provider will not use environment-defined http(s) proxies. In order to have them used you'll
need to require and tell oidc-provider to use [request][request-library] instead.

```sh
# add request to your application package bundle
npm install request@^2.0.0 --save
```

```js
// tell oidc-provider to use request instead of got
Provider.useRequest();
```
need to follow got's [README](https://github.com/sindresorhus/got#proxies) and use e.g.
[`global-tunnel`](https://github.com/np-maintain/global-tunnel)


## Changing HTTP Request Defaults
Expand Down
5 changes: 0 additions & 5 deletions lib/helpers/http/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ const httpWrapper = {
this.get = got.get;
this.post = got.post;
},
useRequest() {
const request = require('./request'); // eslint-disable-line global-require
this.get = request.get;
this.post = request.post;
},
};

module.exports = httpWrapper;
77 changes: 0 additions & 77 deletions lib/helpers/http/request.js

This file was deleted.

12 changes: 2 additions & 10 deletions lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,17 +353,9 @@ class Provider extends events.EventEmitter {
get DeviceCode() { return instance(this).DeviceCode; }

get requestUriCache() { return instance(this).requestUriCache; }

static useGot() { // eslint-disable-line class-methods-use-this
httpWrapper.useGot();
}

static useRequest() { // eslint-disable-line class-methods-use-this
/* istanbul ignore next */
httpWrapper.useRequest();
}
}
Provider.useGot();

httpWrapper.useGot();

['env', 'proxy', 'subdomainOffset', 'keys'].forEach((method) => {
Object.defineProperty(Provider.prototype, method, {
Expand Down

0 comments on commit 683e6c2

Please sign in to comment.