-
-
Notifications
You must be signed in to change notification settings - Fork 127
/
_http_common.d.ts
47 lines (42 loc) · 1.14 KB
/
_http_common.d.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
41
42
43
44
45
46
47
declare var HTTPParser: {
new (): HTTPParser<number>
REQUEST: 0
RESPONSE: 1
readonly kOnHeadersComplete: unique symbol
readonly kOnBody: unique symbol
readonly kOnMessageComplete: unique symbol
}
export interface HTTPParser<ParserType extends number> {
new (): HTTPParser<ParserType>
[HTTPParser.kOnHeadersComplete]: ParserType extends 0
? RequestHeadersCompleteCallback
: ResponseHeadersCompleteCallback
[HTTPParser.kOnBody]: (chunk: Buffer) => void
[HTTPParser.kOnMessageComplete]: () => void
initialize(type: ParserType, asyncResource: object): void
execute(buffer: Buffer): void
finish(): void
free(): void
}
export type RequestHeadersCompleteCallback = (
versionMajor: number,
versionMinor: number,
headers: Array<string>,
idk: number,
path: string,
idk2: unknown,
idk3: unknown,
idk4: unknown,
shouldKeepAlive: boolean
) => void
export type ResponseHeadersCompleteCallback = (
versionMajor: number,
versionMinor: number,
headers: Array<string>,
method: string | undefined,
url: string | undefined,
status: number,
statusText: string,
upgrade: boolean,
shouldKeepAlive: boolean
) => void