-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ClientRequest): use net.Socket interceptor (#515)
Co-authored-by: Michael Solomon <micheal540@gmail.com>
- Loading branch information
1 parent
d514235
commit 77a6996
Showing
74 changed files
with
3,223 additions
and
2,085 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.