On afterResponse
token renewal, chained .text()
|.json()
|.buffer()
method returns the wrong body
#1120
Closed
2 tasks done
Labels
Describe the bug
Given a
client
Got instance with aafterResponse
hook to set/renew OAuth2 token upon 401response.statusCode
Actual behavior
When
.json()
is chained with a got instance with anafterResponse
hook, it returns the json result of the first request and ignores (or overwrites?) the result of the second (and valid) request.Expected behavior
When
.json()
is chained with a got instance with anafterResponse
hook, it should return the json result of the last request.Code to reproduce
Add the following to
test\hooks.ts
and runnpx tsc && npx ava test/hooks.ts
Checklist
The text was updated successfully, but these errors were encountered: