Closed rhazegh closed 3 years ago
Hi @rhazegh you are right, req.getHeader()
should be also available.
Here is the PR with a fix https://github.com/howardabrams/node-mocks-http/pull/241
@eugef Fantastic. Thanks for the quick fix.
BTW, I found out that Nextjs's request object for API routes is an instance of Node's http.IncomingMessage which supports request.headers
so I ended up not using request.getHeader()
. Thanks again.
you are welcome
Thank you for this great library. I am using this to test my Nextjs API routes. It has been working so far until I decided to send some http headers in the request.
In the test file:
When I try to retrieve the headers in the API end point:
According to Nodejs documentation https://nodejs.org/api/http.html#http_request_getheader_name, it seems that
request.getHeader(name)
should be available.Is this something that can be added to node-mocks-http?