Skip to content

Commit

Permalink
fix: add explicit Accept-Encoding header to http requests
Browse files Browse the repository at this point in the history
fixes #648
  • Loading branch information
panva committed Dec 22, 2023
1 parent 4b42b48 commit abcb564
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ requests.

```js
const DEFAULT_HTTP_OPTIONS = {
headers: { 'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})` },
headers: {
'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})`,
'Accept-Encoding': 'identity',
},
timeout: 3500,
};
```
Expand Down
5 changes: 4 additions & 1 deletion lib/helpers/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ const setDefaults = (props, options) => {
};

setDefaults([], {
headers: { 'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})` },
headers: {
'User-Agent': `${pkg.name}/${pkg.version} (${pkg.homepage})`,
'Accept-Encoding': 'identity',
},
timeout: 3500,
});

Expand Down
1 change: 0 additions & 1 deletion lib/issuer.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ class Issuer {
}

static async discover(uri) {

const wellKnownUri = resolveWellKnownUri(uri);

const response = await request.call(this, {
Expand Down
5 changes: 3 additions & 2 deletions test/client/client_instance.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,10 @@ describe('Client', () => {
state: 'state',
scope: 'openid profile email',
}),
).to.eql('https://op.example.com/auth?client_id=identifier&scope=openid%20profile%20email&response_type=code&state=state');
).to.eql(
'https://op.example.com/auth?client_id=identifier&scope=openid%20profile%20email&response_type=code&state=state',
);
});

});

describe('#endSessionUrl', function () {
Expand Down

0 comments on commit abcb564

Please sign in to comment.