Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Jul 11, 2020
1 parent c96889b commit 8d4b2b1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
21 changes: 19 additions & 2 deletions lib/client-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,9 +709,26 @@ function resume (client) {
// Only allow one active request with reset.

const pending = client[kQueue][client[kPendingIdx]]
const running = client[kQueue][client[kRunningIdx]]
if (pending.reset) {
const { streaming, body } = pending

if (streaming) {
if (typeof body.read === 'function') {
body.read(0)
}
const state = body._readableState
if (state && state.ended && state.length === 0) {
pending.reset = false
} else {
return
}
} else {
return
}
}

if (pending.reset || running.reset) {
const running = client[kQueue][client[kRunningIdx]]
if (running.reset) {
return
}
}
Expand Down
9 changes: 0 additions & 9 deletions lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,6 @@ class Request extends AsyncResource {
// to parse the body as a request and provide two responses, corrupting
// undici state.
this.reset = this.body && (method === 'HEAD' || method === 'GET')
if (this.reset && this.streaming) {
if (typeof body.read === 'function') {
body.read(0)
}
const state = body._readableState
if (state && state.ended && state.length === 0) {
this.reset = false
}
}

{
// TODO (perf): Build directy into buffer instead of
Expand Down

0 comments on commit 8d4b2b1

Please sign in to comment.