forked from vercel/micro
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypes.ts
40 lines (38 loc) · 920 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Native
import { IncomingMessage, ServerResponse, IncomingHttpHeaders, Server } from 'http';
export type MicriHandler<OptsType = any> = (req: IncomingMessage, res: ServerResponse, opts?: OptsType) => any;
export { IncomingMessage, ServerResponse, IncomingHttpHeaders, Server };
export interface IncomingOpts {
limit?: string | number;
encoding?: string | null;
}
// The following type is borrowed from raw-body to avoid depending on the whole
// library twice just for proper typing.
export interface RawBodyError extends Error {
/**
* The limit in bytes.
*/
limit?: number;
/**
* The expected length of the stream.
*/
length?: number;
expected?: number;
/**
* The received bytes.
*/
received?: number;
/**
* The encoding.
*/
encoding?: string;
/**
* The corresponding status code for the error.
*/
status: number;
statusCode: number;
/**
* The error type.
*/
type: string;
}