mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Unzip response body only for statuses != 204 (#1129)
This commit is contained in:
@@ -188,7 +188,7 @@ module.exports = function httpAdapter(config) {
|
|||||||
case 'compress':
|
case 'compress':
|
||||||
case 'deflate':
|
case 'deflate':
|
||||||
// add the unzipper to the body stream processing pipeline
|
// add the unzipper to the body stream processing pipeline
|
||||||
stream = stream.pipe(zlib.createUnzip());
|
stream = (res.statusCode === 204) ? stream : stream.pipe(zlib.createUnzip());
|
||||||
|
|
||||||
// remove the content-encoding in order to not confuse downstream operations
|
// remove the content-encoding in order to not confuse downstream operations
|
||||||
delete res.headers['content-encoding'];
|
delete res.headers['content-encoding'];
|
||||||
|
|||||||
Reference in New Issue
Block a user