eugef / node-mocks-http

Mock 'http' objects for testing Express routing functions
Other
747 stars 131 forks source link

Add socket option to mockRequest #209

Closed DorianBlues closed 4 years ago

DorianBlues commented 4 years ago

Overview

I use node-mocks-http with koa2. when I call ctx.cookies.get() methd in koa2 customer middleware,it throw an error:"TypeError: Cannot read property 'encrypted' of undefined".

Suggestions

I found that Koa2 check it's this.socket.encrypted when user call ctx.cookies.get() methd, It seems that the node-mocks-http mockRequest instance need a socket property.

eugef commented 4 years ago

Hi @DorianBlues thanks for the PR.

Please also update the Readme https://github.com/howardabrams/node-mocks-http#createrequest

github-actions[bot] commented 4 years ago

Stale pull request message