actionhero
Version:
actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks
18 lines (17 loc) • 518 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseCookies = void 0;
/**
* Transform the cookie headers of a node HTTP `req` Object into a hash.
*/
function parseCookies(req) {
const cookies = {};
if (req.headers.cookie) {
req.headers.cookie.split(";").forEach((cookie) => {
const parts = cookie.split("=");
cookies[parts[0].trim()] = (parts[1] || "").trim();
});
}
return cookies;
}
exports.parseCookies = parseCookies;