We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
afterResponse
1 parent 982275e commit f726390Copy full SHA for f726390
documentation/migration-guides.md
@@ -110,11 +110,18 @@ const gotInstance = got.extend({
110
}
111
112
],
113
+ beforeRequest: [
114
+ options => {
115
+ if (options.responseType === 'json' && options.jsonReviver) {
116
+ options.responseType = 'text';
117
+ options.customJsonResponse = true;
118
+ }
119
120
+ ],
121
afterResponse: [
122
response => {
123
const {options} = response.request;
- if (options.jsonReviver && options.responseType === 'json') {
- options.responseType = 'text';
124
+ if (options.jsonReviver && options.customJsonResponse) {
125
response.body = JSON.parse(response.body, options.jsonReviver);
126
127
0 commit comments