Added types for koa-sslify

This commit is contained in:
Matthew Bull
2017-12-06 21:21:17 +00:00
parent 67e6191912
commit 8965e9780b
4 changed files with 89 additions and 0 deletions

25
types/koa-sslify/index.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
// Type definitions for koa-sslify 2.1
// Project: https://github.com/turboMaCk/koa-sslify#readme
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as koa from 'koa';
declare namespace sslify {
interface Options {
trustProtoHeader?: boolean;
trustAzureHeader?: boolean;
port?: number;
hostname?: string;
ignoreUrl?: boolean;
temporary?: boolean;
redirectMethods?: string[];
internalRedirectMethods?: string[];
specCompliantDisallow?: boolean;
}
}
declare function sslify(options: sslify.Options): koa.Middleware;
export = sslify;

View File

@@ -0,0 +1,40 @@
import Koa = require('koa');
import sslify = require('koa-sslify');
new Koa().use(sslify({}));
new Koa().use(sslify({
trustAzureHeader: true,
}));
new Koa().use(sslify({
trustProtoHeader: true,
}));
new Koa().use(sslify({
specCompliantDisallow: true,
}));
new Koa().use(sslify({
port: 1234,
}));
new Koa().use(sslify({
hostname: 'my-host',
}));
new Koa().use(sslify({
temporary: false,
}));
new Koa().use(sslify({
internalRedirectMethods: ['GET'],
}));
new Koa().use(sslify({
redirectMethods: ['GET'],
}));
new Koa().use(sslify({
ignoreUrl: true,
}));

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"koa-sslify-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }