@redocly/cli
Version:
[@Redocly](https://redocly.com) CLI is your all-in-one API documentation utility. It builds, manages, improves, and quality-checks your API descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make
18 lines • 709 B
JavaScript
import * as cookie from 'cookie';
export function buildRequestCookies(headers) {
const cookies = [];
for (const [header, headerValue] of Object.entries(headers)) {
if (header.toLowerCase() === 'cookie') {
// Handle both array and single string cases
const cookieValues = Array.isArray(headerValue) ? headerValue : [headerValue];
for (const value of cookieValues) {
const parsed = cookie.parse(value);
for (const [name, value] of Object.entries(parsed)) {
cookies.push({ name, value });
}
}
}
}
return cookies;
}
//# sourceMappingURL=build-request-cookies.js.map