Improve child performances (#1314)

This commit is contained in:
Tomas Della Vedova
2020-09-23 11:31:09 +02:00
committed by delvedor
parent bd8892c37d
commit bd7b38b24e
92 changed files with 17561 additions and 5604 deletions

View File

@ -112,10 +112,17 @@ class Transport {
body: null,
statusCode: null,
headers: null,
warnings: options.warnings || null,
meta
}
Object.defineProperty(result, 'warnings', {
get () {
return this.headers && this.headers.warning
? this.headers.warning.split(/(?!\B"[^"]*),(?![^"]*"\B)/)
: null
}
})
// We should not retry if we are sending a stream body, because we should store in memory
// a copy of the stream to be able to send it again, but since we don't know in advance
// the size of the stream, we risk to take too much memory.
@ -183,11 +190,6 @@ class Transport {
const { statusCode, headers } = response
result.statusCode = statusCode
result.headers = headers
if (headers['warning'] !== undefined) {
result.warnings = result.warnings || []
// split the string over the commas not inside quotes
result.warnings.push.apply(result.warnings, headers['warning'].split(/(?!\B"[^"]*),(?![^"]*"\B)/))
}
if (options.asStream === true) {
result.body = response