mirror of https://github.com/sundowndev/http.git
fix(plugin): allow reusing error.response.json
parent
7023e162f4
commit
77b084bc01
|
@ -96,7 +96,11 @@ for (let method of ['get', 'head', 'delete', 'post', 'put', 'patch']) {
|
|||
if (error.response) {
|
||||
error.statusCode = error.response.status
|
||||
try {
|
||||
error.response.data = destr(await error.response.text())
|
||||
const text = await error.response.text()
|
||||
error.response.text = () => Promise.resolve(text)
|
||||
const json = destr(text)
|
||||
error.response.json = () => Promise.resolve(json)
|
||||
error.response.data = json
|
||||
} catch (_) { }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue