eugef / node-mocks-http

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

`res.hasHeader()` not defined #207

Closed gabssnake closed 4 years ago

gabssnake commented 4 years ago

Hi, thanks for your work on this module :)

What's your point of view on making assertions on headers, e.g. res.hasHeader()? How would one do it while using this module?

Best,

eugef commented 4 years ago

Hi @gabssnake

I suggest you can use res._getHeaders() to make assertions if header exists and has certain value

gabssnake commented 4 years ago

Thank you for your answer. I was specifically interested in cookies, so ended up using req.headers.cookie and res.cookies.