request.d.mts 1.0 KB

12345678910111213141516171819202122232425
  1. import { IncomingMessage } from 'node:http';
  2. import { Http2ServerRequest } from 'node:http2';
  3. declare class RequestError extends Error {
  4. constructor(message: string, options?: {
  5. cause?: unknown;
  6. });
  7. }
  8. declare const toRequestError: (e: unknown) => RequestError;
  9. declare const GlobalRequest: {
  10. new (input: RequestInfo | URL, init?: RequestInit): globalThis.Request;
  11. prototype: globalThis.Request;
  12. };
  13. declare class Request extends GlobalRequest {
  14. constructor(input: string | Request, options?: RequestInit);
  15. }
  16. type IncomingMessageWithWrapBodyStream = IncomingMessage & {
  17. [wrapBodyStream]: boolean;
  18. };
  19. declare const wrapBodyStream: unique symbol;
  20. declare const abortControllerKey: unique symbol;
  21. declare const getAbortController: unique symbol;
  22. declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
  23. export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };