|
@@ -19,8 +19,8 @@ class IncomingMessage extends Readable {
|
|
|
constructor (urlRequest) {
|
|
|
super()
|
|
|
this._url_request = urlRequest
|
|
|
- this._shouldPush = false;
|
|
|
- this._data = [];
|
|
|
+ this._shouldPush = false
|
|
|
+ this._data = []
|
|
|
this._url_request.on('data', (event, chunk) => {
|
|
|
this._storeInternalData(chunk)
|
|
|
this._pushInternalData()
|
|
@@ -59,26 +59,26 @@ class IncomingMessage extends Readable {
|
|
|
return this._url_request.rawResponseHeaders
|
|
|
}
|
|
|
|
|
|
- get rawTrailers() {
|
|
|
- throw (new Error('HTTP trailers are not supported.'))
|
|
|
+ get rawTrailers () {
|
|
|
+ throw new Error('HTTP trailers are not supported.')
|
|
|
}
|
|
|
|
|
|
- get trailers() {
|
|
|
- throw (new Error('HTTP trailers are not supported.'))
|
|
|
+ get trailers () {
|
|
|
+ throw new Error('HTTP trailers are not supported.')
|
|
|
}
|
|
|
|
|
|
- _storeInternalData(chunk) {
|
|
|
+ _storeInternalData (chunk) {
|
|
|
this._data.push(chunk)
|
|
|
}
|
|
|
|
|
|
- _pushInternalData() {
|
|
|
+ _pushInternalData () {
|
|
|
while (this._shouldPush && this._data.length > 0) {
|
|
|
- const chunk = this._data.shift()
|
|
|
- this._shouldPush = this.push(chunk)
|
|
|
+ const chunk = this._data.shift()
|
|
|
+ this._shouldPush = this.push(chunk)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- _read() {
|
|
|
+ _read () {
|
|
|
this._shouldPush = true
|
|
|
this._pushInternalData()
|
|
|
}
|
|
@@ -141,7 +141,6 @@ class ClientRequest extends EventEmitter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (options.path && / /.test(options.path)) {
|
|
|
// The actual regex is more like /[^A-Za-z0-9\-._~!$&'()*+,;=/:@]/
|
|
|
// with an additional rule for ignoring percentage-escaped characters
|
|
@@ -150,9 +149,9 @@ class ClientRequest extends EventEmitter {
|
|
|
// why it only scans for spaces because those are guaranteed to create
|
|
|
// an invalid request.
|
|
|
throw new TypeError('Request path contains unescaped characters.')
|
|
|
- }
|
|
|
+ }
|
|
|
let pathObj = url.parse(options.path || '/')
|
|
|
- urlObj.pathname = pathObj.pathname
|
|
|
+ urlObj.pathname = pathObj.pathname
|
|
|
urlObj.search = pathObj.search
|
|
|
urlObj.hash = pathObj.hash
|
|
|
urlStr = url.format(urlObj)
|