1.1.3 • Published 30 days ago

koa-auto-transfer-header v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
30 days ago

koa-auto-transfer-header

In a Koa server, when a client request is received and an external HTTP request is initiated in the request, the request header initiated by the client is automatically forwarded.

Also used in a server started from any Web Framework.

Support all http-client libs based on http module.

Installation

npm install koa-auto-transfer-header [--save]
or
yarn add koa-auto-transfer-header

Usage

import in portal file

import 'koa-auto-transfer-header';

Config

interface IConfig {
	enable: boolean;		// is enable tranfer, default: true
	transferHeaders: string[],	// transfer header keys, default: ['request-id', 'trace-id']
}

disable transfer

import { disableTransferHeaders } from 'koa-auto-transfer-header';

disableTransferHeaders();

add transfer header

import { addTransferHeader } from 'koa-auto-transfer-header';

addTransferHeader('my-header');

reset transfer headers

import { setTransferHeaders } from 'koa-auto-transfer-header';

setTransferHeaders(['my-header1', 'my-header2']);
1.1.3

30 days ago

1.1.1

2 months ago

1.1.0

2 months ago

1.1.2

2 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago