forked from unjs/unenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
49 lines (44 loc) · 1.71 KB
/
index.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
48
49
// https://nodejs.org/api/http.html
import type http from "node:http";
import { notImplemented } from "../../_internal/utils";
import mock from "../../mock/proxy";
import * as consts from "./_consts";
import { IncomingMessage } from "./_request";
import { ServerResponse } from "./_response";
export * from "./_consts";
export * from "./_request";
export * from "./_response";
export const createServer: typeof http.createServer =
notImplemented("http.createServer");
export const request: typeof http.request = notImplemented("http.request");
export const get: typeof http.get = notImplemented("http.get");
export const Server: typeof http.Server = mock.__createMock__("http.Server");
export const OutgoingMessage: typeof http.OutgoingMessage = mock.__createMock__(
"http.OutgoingMessage"
);
export const ClientRequest: typeof http.ClientRequest =
mock.__createMock__("http.ClientRequest");
export const Agent: typeof http.Agent = mock.__createMock__("http.Agent");
export const globalAgent: typeof http.globalAgent = new Agent();
export const validateHeaderName: typeof http.validateHeaderName =
notImplemented("http.validateHeaderName");
export const validateHeaderValue: typeof http.validateHeaderValue =
notImplemented("http.validateHeaderValue");
export const setMaxIdleHTTPParsers: typeof http.setMaxIdleHTTPParsers =
notImplemented("http.setMaxIdleHTTPParsers");
export default <typeof http>{
...consts,
IncomingMessage: IncomingMessage as any as typeof http.IncomingMessage,
ServerResponse: ServerResponse as any as typeof http.ServerResponse,
createServer,
request,
get,
Server,
OutgoingMessage,
ClientRequest,
Agent,
globalAgent,
validateHeaderName,
validateHeaderValue,
setMaxIdleHTTPParsers,
};