-
-
Notifications
You must be signed in to change notification settings - Fork 379
/
Copy pathmiddleware.d.ts
54 lines (54 loc) · 1.71 KB
/
middleware.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
48
49
50
51
52
53
54
/// <reference types="node" />
export = wrapper;
/**
* @template {IncomingMessage} Request
* @template {ServerResponse} Response
* @typedef {Object} SendErrorOptions send error options
* @property {Record<string, number | string | string[] | undefined>=} headers headers
* @property {import("./index").ModifyResponseData<Request, Response>=} modifyResponseData modify response data callback
*/
/**
* @template {IncomingMessage} Request
* @template {ServerResponse} Response
* @param {import("./index.js").FilledContext<Request, Response>} context
* @return {import("./index.js").Middleware<Request, Response>}
*/
declare function wrapper<
Request extends import("http").IncomingMessage,
Response extends import("./index.js").ServerResponse,
>(
context: import("./index.js").FilledContext<Request, Response>,
): import("./index.js").Middleware<Request, Response>;
declare namespace wrapper {
export {
SendErrorOptions,
NextFunction,
IncomingMessage,
ServerResponse,
NormalizedHeaders,
ReadStream,
};
}
/**
* send error options
*/
type SendErrorOptions<
Request extends import("http").IncomingMessage,
Response extends import("./index.js").ServerResponse,
> = {
/**
* headers
*/
headers?: Record<string, number | string | string[] | undefined> | undefined;
/**
* modify response data callback
*/
modifyResponseData?:
| import("./index").ModifyResponseData<Request, Response>
| undefined;
};
type NextFunction = import("./index.js").NextFunction;
type IncomingMessage = import("./index.js").IncomingMessage;
type ServerResponse = import("./index.js").ServerResponse;
type NormalizedHeaders = import("./index.js").NormalizedHeaders;
type ReadStream = import("fs").ReadStream;