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

@apimatic/http-headers

Package Overview
Dependencies
Maintainers
4
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apimatic/http-headers - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

32

es/httpHeaders.js
import { __values } from 'tslib';
/**

@@ -11,3 +12,2 @@ * Set a header in the headers map.

*/
function setHeader(headers, name, value) {

@@ -17,3 +17,2 @@ var realHeaderName = lookupCaseInsensitive(headers, name);

}
function setHeaderInternal(headers, realHeaderName, name, value) {

@@ -23,3 +22,2 @@ if (realHeaderName) {

}
if (value) {

@@ -38,7 +36,4 @@ headers[name] = value;

*/
function setHeaderIfNotSet(headers, name, value) {
var realHeaderName = lookupCaseInsensitive(headers, name);
if (!realHeaderName) {

@@ -56,11 +51,7 @@ setHeaderInternal(headers, realHeaderName, name, value);

*/
function getHeader(headers, name) {
var prop = lookupCaseInsensitive(headers, name);
if (prop) {
return headers[prop];
}
return null;

@@ -77,7 +68,4 @@ }

*/
function lookupCaseInsensitive(obj, prop) {
prop = prop.toLowerCase();
for (var p in obj) {

@@ -88,3 +76,2 @@ if (Object.prototype.hasOwnProperty.call(obj, p) && prop === p.toLowerCase()) {

}
return null;

@@ -102,9 +89,5 @@ }

*/
function mergeHeaders(headers, headersToMerge) {
var e_1, _a, e_2, _b;
var headerKeys = {};
try {

@@ -127,3 +110,2 @@ // Create a map of lower-cased-header-name to original-header-names

}
try {

@@ -134,7 +116,5 @@ // Override headers with new values

var lowerCasedName = headerName.toLowerCase();
if (headerKeys[lowerCasedName]) {
delete headers[headerKeys[lowerCasedName]];
}
headerKeys[lowerCasedName] = headerName;

@@ -158,21 +138,14 @@ headers[headerName] = headersToMerge[headerName];

*/
function assertHeaders(headers) {
var e_3, _a;
if (headers === null || typeof headers !== 'object') {
throw new TypeError('Headers must be an object.');
}
try {
for (var _b = __values(Object.getOwnPropertyNames(headers)), _c = _b.next(); !_c.done; _c = _b.next()) {
var headerName = _c.value;
if (!isValidHeaderName(headerName)) {
throw new Error("\"" + headerName + "\" is not a valid header name.");
}
var headerValue = headers[headerName];
if (typeof headerValue !== 'string') {

@@ -198,8 +171,5 @@ throw new TypeError("Header value must be string but " + typeof headerValue + " provided.");

*/
function isValidHeaderName(headerName) {
return /^[\w!#$%&'*+.^`|~-]+$/.test(headerName);
}
var CONTENT_TYPE_HEADER = 'content-type';

@@ -206,0 +176,0 @@ var ACCEPT_HEADER = 'accept';

6

package.json
{
"name": "@apimatic/http-headers",
"author": "APIMatic Ltd.",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",

@@ -43,4 +43,4 @@ "sideEffects": false,

"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.10.5",
"@babel/cli": "^7.21.5",
"@babel/core": "^7.22.1",
"@size-limit/preset-small-lib": "^7.0.8",

@@ -47,0 +47,0 @@ "babel-plugin-annotate-pure-calls": "^0.4.0",

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