diff --git a/documentation/migration-guides.md b/documentation/migration-guides.md index 80aded453..56b441183 100644 --- a/documentation/migration-guides.md +++ b/documentation/migration-guides.md @@ -110,11 +110,18 @@ const gotInstance = got.extend({ } } ], + beforeRequest: [ + options => { + if (options.responseType === 'json' && options.jsonReviver) { + options.responseType = 'text'; + options.customJsonResponse = true; + } + } + ], afterResponse: [ response => { const {options} = response.request; - if (options.jsonReviver && options.responseType === 'json') { - options.responseType = 'text'; + if (options.jsonReviver && options.customJsonResponse) { response.body = JSON.parse(response.body, options.jsonReviver); }