diachedelic/mock-res

Support for cookies?

Closed this issue · 3 comments

Is there support for cookies? The documentation doesn't mention this

I think so, insomuch as Cookies are just headers. The following example from the Node docs should work, let me know if it's doesn't:

response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']);

const setCookie = response.getHeader('set-cookie');
// setCookie is of type string[]

See also this module for parsing/serialising cookies: https://www.npmjs.com/package/cookie

I've lightly documented it here: ab14b00