Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: request.end accepted arguments (#1591)
* Fix typo about wrapping request.end. I'm making this change it's own commit so I have a place to comment the findings. Digging through Node git history, I found the change that created the breaking change in nock (ref nock PR 929). nodejs/node@a10bdb5#diff-286202fdbdd74ede6f5f5334b6176b5cL779 Before Node v8, `OutgoingMessage`, which is extended by `ClientRequest`, would literally do what it says in the docs if data was provided. It would call `this.write(data, encoding)`. This meant that nock could wrap only the `write` method when recording and gather all the chunks even if the last chunk was sent to `end`. But, the above changed that to call an internal function dual used by `end` and `write`. * fix: request.end accepted arguments. Fixes #1549 The method now correctly accepts all the permutations allowed. request.end(data, encoding, callback) request.end(data, callback) request.end(data, encoding) request.end(data) request.end(callback) request.end() And a few tests were added to ensure all cases are explicitly covered.
- Loading branch information
1 parent
e200e83
commit ad34222
Showing
4 changed files
with
152 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters