@types/koa-bodyparser
Advanced tools
Comparing version 4.3.0 to 4.3.1
@@ -7,4 +7,5 @@ // Type definitions for koa-bodyparser 4.3 | ||
// Alexi Maschas <https://github.com/amaschas> | ||
// Piotr Kuczynski <https://github.com/pkuczynski> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.3 | ||
// TypeScript Version: 3.0 | ||
@@ -21,7 +22,7 @@ /* =================== USAGE =================== | ||
import * as Koa from "koa"; | ||
import * as Koa from 'koa'; | ||
declare module "koa" { | ||
declare module 'koa' { | ||
interface Request { | ||
body?: any; | ||
body: string | Record<string, unknown>; | ||
rawBody: string; | ||
@@ -39,2 +40,3 @@ } | ||
enableTypes?: string[]; | ||
/** | ||
@@ -41,0 +43,0 @@ * requested encoding. Default is utf-8 by co-body |
{ | ||
"name": "@types/koa-bodyparser", | ||
"version": "4.3.0", | ||
"version": "4.3.1", | ||
"description": "TypeScript definitions for koa-bodyparser", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser", | ||
"license": "MIT", | ||
@@ -26,6 +27,11 @@ "contributors": [ | ||
"githubUsername": "amaschas" | ||
}, | ||
{ | ||
"name": "Piotr Kuczynski", | ||
"url": "https://github.com/pkuczynski", | ||
"githubUsername": "pkuczynski" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -40,4 +46,4 @@ "type": "git", | ||
}, | ||
"typesPublisherContentHash": "e5d144c62623d427b829e3a3399e39580bce9a2b057df6d6d4c23ec9a08f14f7", | ||
"typeScriptVersion": "2.3" | ||
"typesPublisherContentHash": "5b8afa647bdd6aa0281026d16ffe93e9d2ac2efeccff30ce8287144d9628760b", | ||
"typeScriptVersion": "3.6" | ||
} |
@@ -5,13 +5,103 @@ # Installation | ||
# Summary | ||
This package contains type definitions for koa-bodyparser ( https://github.com/koajs/body-parser ). | ||
This package contains type definitions for koa-bodyparser (https://github.com/koajs/body-parser). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser. | ||
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/koa-bodyparser/index.d.ts) | ||
````ts | ||
// Type definitions for koa-bodyparser 4.3 | ||
// Project: https://github.com/koajs/body-parser | ||
// Definitions by: Jerry Chin <https://github.com/hellopao> | ||
// Anup Kishore <https://github.com/anup-2s> | ||
// Hiroshi Ioka <https://github.com/hirochachacha> | ||
// Alexi Maschas <https://github.com/amaschas> | ||
// Piotr Kuczynski <https://github.com/pkuczynski> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 3.0 | ||
Additional Details | ||
* Last updated: Fri, 24 May 2019 20:56:01 GMT | ||
* Dependencies: @types/koa | ||
/* =================== USAGE =================== | ||
import bodyParser = require("koa-bodyparser"); | ||
var Koa = require('koa'); | ||
var app = new Koa(); | ||
app.use(bodyParser()); | ||
=============================================== */ | ||
import * as Koa from 'koa'; | ||
declare module 'koa' { | ||
interface Request { | ||
body: string | Record<string, unknown>; | ||
rawBody: string; | ||
} | ||
} | ||
declare function bodyParser(opts?: bodyParser.Options): Koa.Middleware; | ||
declare namespace bodyParser { | ||
interface Options { | ||
/** | ||
* parser will only parse when request type hits enableTypes, default is ['json', 'form']. | ||
*/ | ||
enableTypes?: string[]; | ||
/** | ||
* requested encoding. Default is utf-8 by co-body | ||
*/ | ||
encode?: string; | ||
/** | ||
* limit of the urlencoded body. If the body ends up being larger than this limit | ||
* a 413 error code is returned. Default is 56kb | ||
*/ | ||
formLimit?: string; | ||
/** | ||
* limit of the json body. Default is 1mb | ||
*/ | ||
jsonLimit?: string; | ||
/** | ||
* limit of the text body. Default is 1mb. | ||
*/ | ||
textLimit?: string; | ||
/** | ||
* when set to true, JSON parser will only accept arrays and objects. Default is true | ||
*/ | ||
strict?: boolean; | ||
/** | ||
* custom json request detect function. Default is null | ||
*/ | ||
detectJSON?: (ctx: Koa.Context) => boolean; | ||
/** | ||
* support extend types | ||
*/ | ||
extendTypes?: { | ||
json?: string[]; | ||
form?: string[]; | ||
text?: string[]; | ||
}; | ||
/** | ||
* support custom error handle | ||
*/ | ||
onerror?: (err: Error, ctx: Koa.Context) => void; | ||
} | ||
} | ||
export = bodyParser; | ||
```` | ||
### Additional Details | ||
* Last updated: Sat, 05 Jun 2021 00:01:32 GMT | ||
* Dependencies: [@types/koa](https://npmjs.com/package/@types/koa) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Jerry Chin <https://github.com/hellopao>, Anup Kishore <https://github.com/anup-2s>, Hiroshi Ioka <https://github.com/hirochachacha>, Alexi Maschas <https://github.com/amaschas>. | ||
These definitions were written by [Jerry Chin](https://github.com/hellopao), [Anup Kishore](https://github.com/anup-2s), [Hiroshi Ioka](https://github.com/hirochachacha), [Alexi Maschas](https://github.com/amaschas), and [Piotr Kuczynski](https://github.com/pkuczynski). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
8107
69
0
107