Skip to content

Commit

Permalink
Make it easier to create mocks for the node http library (#259)
Browse files Browse the repository at this point in the history
  • Loading branch information
B3none authored Nov 2, 2022
1 parent a0ad193 commit 695a048
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mockRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ function createRequest(options) {
mockRequest.ip = options.ip || '127.0.0.1';
mockRequest.ips = [mockRequest.ip];

mockRequest.destroy = () => {};

//parse query string from url to object
if (Object.keys(mockRequest.query).length === 0) {
mockRequest.query = require('querystring').parse(mockRequest.url.split('?')[1]);
Expand Down

0 comments on commit 695a048

Please sign in to comment.