Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mockResponse.end(): added callback triggering once end() logic has run. #248

Merged
merged 6 commits into from
Aug 30, 2021
6 changes: 3 additions & 3 deletions lib/mockResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,14 @@ function createResponse(options) {
};

/**
* Function: getEndParameters
* Function: getEndArguments
*
* Utility function that parses and names parameters for the various
* mockResponse.end() signatures. Reference:
* https://nodejs.org/api/http.html#http_response_end_data_encoding_callback
*
*/
function getEndParameters(args) {
function getEndArguments(args) {
var data, encoding, callback;
if (args[0]) {
if (typeof args[0] === 'function') {
Expand Down Expand Up @@ -436,7 +436,7 @@ function createResponse(options) {

_endCalled = true;

var args = getEndParameters(arguments);
var args = getEndArguments(arguments);

if (args.data) {
if (args.data instanceof Buffer) {
Expand Down