mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[koa-proxy] new type definitions (#37264)
This commit is contained in:
parent
22dffbebe4
commit
97c54e5eea
29
types/koa-proxy/index.d.ts
vendored
Normal file
29
types/koa-proxy/index.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for koa-proxy 1.0
|
||||
// Project: https://github.com/edorivai/koa-proxy#readme
|
||||
// Definitions by: ishen7 <https://github.com/ishen7>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as Koa from 'koa';
|
||||
|
||||
declare namespace proxy {
|
||||
type RequestOptionFunc = (request: Koa.Request, opts: any) => any;
|
||||
|
||||
interface Options {
|
||||
host?: string;
|
||||
url?: string;
|
||||
map?: { [key: string]: string };
|
||||
match?: RegExp;
|
||||
jar?: boolean;
|
||||
suppressRequestHeaders?: string[]; // case-insensitive
|
||||
suppressResponseHeaders?: string[]; // case-insensitive
|
||||
overrideResponseHeaders?: any;
|
||||
requestOptions?: RequestOptionFunc | { [key: string]: string };
|
||||
followRedirect?: boolean;
|
||||
yieldNext?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function proxy(options?: proxy.Options): Koa.Middleware;
|
||||
|
||||
export = proxy;
|
||||
9
types/koa-proxy/koa-proxy-tests.ts
Normal file
9
types/koa-proxy/koa-proxy-tests.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import Koa = require('koa');
|
||||
import proxy = require('koa-proxy');
|
||||
|
||||
const app = new Koa();
|
||||
app.use(proxy({
|
||||
host: 'https://api.github.com',
|
||||
match: /^\/repos\//
|
||||
}));
|
||||
app.listen(3000);
|
||||
23
types/koa-proxy/tsconfig.json
Normal file
23
types/koa-proxy/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"strictFunctionTypes": true,
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"koa-proxy-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/koa-proxy/tslint.json
Normal file
1
types/koa-proxy/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user