Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

netlify-headers-parser

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netlify-headers-parser - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

2

package.json
{
"name": "netlify-headers-parser",
"version": "1.1.0",
"version": "1.1.1",
"description": "Parses Netlify headers into a JavaScript object representation",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -75,8 +75,16 @@ const isPlainObj = require('is-plain-obj')

if (typeof rawValue !== 'string') {
throw new TypeError(`Header "${key}" value must be a string not: ${rawValue}`)
const value = normalizeRawValue(key, rawValue)
return [key, value]
}
const normalizeRawValue = function (key, rawValue) {
if (typeof rawValue === 'string') {
return normalizeMultipleValues(normalizeStringValue(rawValue))
}
const value = normalizeMultipleValues(rawValue.trim())
return [key, value]
if (Array.isArray(rawValue)) {
return rawValue.map((singleValue, index) => normalizeArrayItemValue(`${key}[${index}]`, singleValue)).join(',')
}
throw new TypeError(`Header "${key}" value must be a string not: ${rawValue}`)
}

@@ -105,2 +113,14 @@

const normalizeArrayItemValue = function (key, singleValue) {
if (typeof singleValue !== 'string') {
throw new TypeError(`Header "${key}" value must be a string not: ${singleValue}`)
}
return normalizeStringValue(singleValue)
}
const normalizeStringValue = function (stringValue) {
return stringValue.trim()
}
module.exports = { normalizeHeaders }
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc