You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@osskit/enforce-client-headers

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@osskit/enforce-client-headers

Enforce headers against http calls to your API

0.0.9
latest
Source
npmnpm
Version published
Weekly downloads
18
500%
Maintainers
1
Weekly downloads
 
Created
Source

enforce-client-headers

Enforce headers against http calls to your API

Install

yarn add @osskit/enforce-client-headers

Usages

Simple

import { enforceClientHeaders } from '@osskit/enforce-client-headers'

const server = express();
const socketServer = io();

server.use(enforceClientHeaders());
socketServer.use(enforceClientHeaders());

Extra headers

import { enforceClientHeaders, requiredHeaders } from '@osskit/enforce-client-headers'

const server = express();
const socketServer = io();

const headers = [...requiredHeaders, 'my-extra-header'];

server.use(enforceClientHeaders({headers});
socketServer.use(enforceClientHeaders, {headers});

API

enforceClientHeaders({headers})

headers

Type: string[]

The headers you want to enforce on the request

Throws a 400 - missing ${header} error upon missing required header

requiredHeaders

Type: string[], by default ['x-api-client', 'x-api-client-version']

FAQs

Package last updated on 20 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts