Skip to content

Commit 409468f

Browse files
committed
1 parent 1f6daf5 commit 409468f

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

node_modules/minipass-fetch/lib/body.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const FetchError = require('./fetch-error.js')
1010
let convert
1111
try {
1212
convert = require('encoding').convert
13-
} catch (e) {}
13+
} catch (e) {
14+
// defer error until textConverted is called
15+
}
1416

1517
const INTERNALS = Symbol('Body internals')
1618
const CONSUME_BODY = Symbol('consumeBody')
@@ -69,16 +71,16 @@ class Body {
6971
))
7072
}
7173

72-
json () {
73-
return this[CONSUME_BODY]().then(buf => {
74-
try {
75-
return JSON.parse(buf.toString())
76-
} catch (er) {
77-
return Promise.reject(new FetchError(
78-
`invalid json response body at ${
79-
this.url} reason: ${er.message}`, 'invalid-json'))
80-
}
81-
})
74+
async json () {
75+
try {
76+
const buf = await this[CONSUME_BODY]()
77+
return JSON.parse(buf.toString())
78+
} catch (er) {
79+
throw new FetchError(
80+
`invalid json response body at ${this.url} reason: ${er.message}`,
81+
'invalid-json'
82+
)
83+
}
8284
}
8385

8486
text () {

node_modules/minipass-fetch/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "minipass-fetch",
3-
"version": "2.1.0",
3+
"version": "2.1.1",
44
"description": "An implementation of window.fetch in Node.js using Minipass streams",
55
"license": "MIT",
66
"main": "lib/index.js",
@@ -23,10 +23,11 @@
2323
},
2424
"devDependencies": {
2525
"@npmcli/eslint-config": "^3.0.1",
26-
"@npmcli/template-oss": "3.1.2",
26+
"@npmcli/template-oss": "3.5.0",
2727
"@ungap/url-search-params": "^0.2.2",
2828
"abort-controller": "^3.0.0",
2929
"abortcontroller-polyfill": "~1.7.3",
30+
"encoding": "^0.1.13",
3031
"form-data": "^4.0.0",
3132
"nock": "^13.2.4",
3233
"parted": "^0.1.1",
@@ -61,6 +62,6 @@
6162
"author": "GitHub Inc.",
6263
"templateOSS": {
6364
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
64-
"version": "3.1.2"
65+
"version": "3.5.0"
6566
}
6667
}

package-lock.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4819,9 +4819,10 @@
48194819
}
48204820
},
48214821
"node_modules/minipass-fetch": {
4822-
"version": "2.1.0",
4822+
"version": "2.1.1",
4823+
"resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.1.tgz",
4824+
"integrity": "sha512-/kgtXVGS10PTFET6dAbOBWQtgH+iDiI4NhRqAftojRlsOJhk0y45sVVxqCaRQC+AMFH7JkHiWpuKJKQ+mojKiA==",
48234825
"inBundle": true,
4824-
"license": "MIT",
48254826
"dependencies": {
48264827
"minipass": "^3.1.6",
48274828
"minipass-sized": "^1.0.3",

0 commit comments

Comments
 (0)