UNPKG

set-cookie

Version:

Set a cookie using the same API on both the client and the server.

10 lines (8 loc) 259 B
/** * Cookie setter for Node.js environment. */ module.exports = function setter(cookieStr, options) { var res = options && options.res; if (!res) throw new Error('Must specify `res` when setting cookie.'); res.setHeader('Set-Cookie', cookieStr); };