Handle compression for streams

This commit is contained in:
delvedor
2019-02-12 16:40:10 +01:00
parent 0355322ef4
commit e4669e656d

View File

@ -96,7 +96,11 @@ class Transport {
headers['Content-Type'] = 'application/json'
if (compression === 'gzip') {
params.body = intoStream(params.body).pipe(createGzip())
if (isStream(params.body) === false) {
params.body = intoStream(params.body).pipe(createGzip())
} else {
params.body = params.body.pipe(createGzip())
}
headers['Content-Encoding'] = compression
}