Skip to content

Commit 5eff7c1

Browse files
fix: update got & remove outdated workaround (#5437)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 78a1932 commit 5eff7c1

File tree

3 files changed

+22
-45
lines changed

3 files changed

+22
-45
lines changed

npm-shrinkwrap.json

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
"eslint-plugin-sort-destructure-keys": "^1.3.5",
190190
"fast-glob": "^3.2.7",
191191
"form-data": "^4.0.0",
192-
"got": "^11.8.1",
192+
"got": "^11.8.6",
193193
"graphviz": "^0.0.9",
194194
"husky": "^8.0.0",
195195
"ini": "^2.0.0",

tests/integration/utils/got.cjs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
const got = require('got')
22

3-
const STATUS_CODE_LIMIT_OK = 299
4-
const STATUS_CODE_LIMIT_REDIRECT = 399
5-
6-
const isResponseOk = (response) => {
7-
const { statusCode } = response
8-
const limitStatusCode = response.request.options.followRedirect ? STATUS_CODE_LIMIT_OK : STATUS_CODE_LIMIT_REDIRECT
9-
10-
return (statusCode >= 200 && statusCode <= limitStatusCode) || statusCode === 304
11-
}
12-
133
const TIMEOUT = 3e5
144

155
// Default got retry status code with the addition of 403
@@ -20,19 +10,6 @@ const extendedGot = got.extend({
2010
statusCodes: STATUS_CODE,
2111
},
2212
timeout: TIMEOUT,
23-
// TODO: remove when https://github.com/sindresorhus/got/issues/1489 is fixed
24-
// see https://github.com/sindresorhus/got/issues/1489#issuecomment-805485731
25-
hooks: {
26-
afterResponse: [
27-
(response) => {
28-
if (isResponseOk(response)) {
29-
response.request.destroy()
30-
}
31-
32-
return response
33-
},
34-
],
35-
},
3613
})
3714

3815
module.exports = extendedGot

0 commit comments

Comments
 (0)