Skip to content

Commit

Permalink
fix: update got & remove outdated workaround (#5437)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
tinfoil-knight and kodiakhq[bot] authored Jan 30, 2023
1 parent 78a1932 commit 5eff7c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 45 deletions.
42 changes: 21 additions & 21 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
"eslint-plugin-sort-destructure-keys": "^1.3.5",
"fast-glob": "^3.2.7",
"form-data": "^4.0.0",
"got": "^11.8.1",
"got": "^11.8.6",
"graphviz": "^0.0.9",
"husky": "^8.0.0",
"ini": "^2.0.0",
Expand Down
23 changes: 0 additions & 23 deletions tests/integration/utils/got.cjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
const got = require('got')

const STATUS_CODE_LIMIT_OK = 299
const STATUS_CODE_LIMIT_REDIRECT = 399

const isResponseOk = (response) => {
const { statusCode } = response
const limitStatusCode = response.request.options.followRedirect ? STATUS_CODE_LIMIT_OK : STATUS_CODE_LIMIT_REDIRECT

return (statusCode >= 200 && statusCode <= limitStatusCode) || statusCode === 304
}

const TIMEOUT = 3e5

// Default got retry status code with the addition of 403
Expand All @@ -20,19 +10,6 @@ const extendedGot = got.extend({
statusCodes: STATUS_CODE,
},
timeout: TIMEOUT,
// TODO: remove when https://github.com/sindresorhus/got/issues/1489 is fixed
// see https://github.com/sindresorhus/got/issues/1489#issuecomment-805485731
hooks: {
afterResponse: [
(response) => {
if (isResponseOk(response)) {
response.request.destroy()
}

return response
},
],
},
})

module.exports = extendedGot

1 comment on commit 5eff7c1

@github-actions
Copy link

Choose a reason for hiding this comment

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

📊 Benchmark results

  • Package size: 265 MB

Please sign in to comment.