Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is the purpose of this pull request?
What changes did you make? (provide an overview)
Response
implementation.Which issue (if any) does this pull request address?
See test case illustrating the issue. It throws exception without this fix.
Is there anything you'd like reviewers to know?
I had to workaround code coverage problem which reported issue for the line https://coveralls.io/builds/38068042/source?filename=src%2Fbody.js#L350 which is unreachable because
FormData
body is normalized into a stream and I don't believe there are no code paths in which request/response.body
could beFormData
.node-fetch/src/body.js
Lines 53 to 56 in 1780f5a
I do not believe changes here affected code coverage, however instead of removing those lines (which break no tests) I've added a assertion to exercise that code path.
Normalizing
FormData
to stream during body initialization has a problem of making content length undetectable:node-fetch/src/request.js
Line 172 in 1780f5a
And this code path will never be called
node-fetch/src/body.js
Lines 352 to 355 in 1780f5a
But I'll defer this to another issue
(Last) commit dc5be05 adds bunch of type annotations which helped me to reason through by getting better IntelliSense as opposed to remembering all the ins and outs. Feel free to get rid of it if you don't want them.