2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-05 16:42:32 +03:00

Unzip response body only for statuses != 204 (#1129)

This commit is contained in:
drawski
2019-05-15 21:35:09 +02:00
committed by Emily Morehouse
parent 92d231387f
commit fd0c959355
+1 -1
View File
@@ -188,7 +188,7 @@ module.exports = function httpAdapter(config) {
case 'compress':
case 'deflate':
// 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
delete res.headers['content-encoding'];