Do not retry a request if the body is a stream (#1143)

* Do not retry a request if the body is a stream

Refactored the trnasport.request method to not use stream for gzipping
the body, but use the callback API instead. The maxRetries will be 0 in
case of a stream body and cached the Accept-Encoding header.

* Updated dependencies

* Updated test
This commit is contained in:
Tomas Della Vedova
2020-04-06 12:16:21 +02:00
committed by GitHub
parent d10e8bb9f3
commit e67b55d163
4 changed files with 209 additions and 99 deletions

View File

@ -32,10 +32,7 @@ test('Should emit a request event when a request is performed', t => {
method: 'GET',
path: '/test/_search',
body: '',
querystring: 'q=foo%3Abar',
headers: {
'Content-Length': '0'
}
querystring: 'q=foo%3Abar'
},
options: {},
id: 1
@ -83,10 +80,7 @@ test('Should emit a response event in case of a successful response', t => {
method: 'GET',
path: '/test/_search',
body: '',
querystring: 'q=foo%3Abar',
headers: {
'Content-Length': '0'
}
querystring: 'q=foo%3Abar'
},
options: {},
id: 1
@ -132,10 +126,7 @@ test('Should emit a response event with the error set', t => {
method: 'GET',
path: '/test/_search',
body: '',
querystring: 'q=foo%3Abar',
headers: {
'Content-Length': '0'
}
querystring: 'q=foo%3Abar'
},
options: {
requestTimeout: 500