UNPKG

infrastructure-components

Version:

Infrastructure-Components configure the infrastructure of your React-App as part of your React-Components.

24 lines (19 loc) 580 B
'use strict'; const setCookieVariations = require('./set-cookie.json').variations; module.exports = function sanitizeHeaders(headers) { return Object.keys(headers).reduce((memo, key) => { const value = headers[key]; if (Array.isArray(value)) { if (key.toLowerCase() === 'set-cookie') { value.forEach((cookie, i) => { memo[setCookieVariations[i]] = cookie; }); } else { memo[key] = value.join(', '); } } else { memo[key] = value.toString(); } return memo; }, {}); };