index.d.ts 696 B

12345678910111213141516171819202122
  1. import { IncomingMessage, Agent, OutgoingHttpHeaders } from "http";
  2. import { Readable } from "stream";
  3. export interface Options {
  4. 'method'?: string;
  5. 'readTimeout'?: number;
  6. 'connectTimeout'?: number;
  7. 'timeout'?: number;
  8. 'agent'?: Agent;
  9. 'headers'?: OutgoingHttpHeaders;
  10. 'rejectUnauthorized'?: boolean;
  11. 'compression'?: boolean;
  12. 'beforeRequest'?(options: Options): void;
  13. 'data'?: string | Buffer | Readable | undefined;
  14. 'key'?: string;
  15. 'cert'?: string;
  16. 'ca'?: string;
  17. }
  18. export function request(url: string, options: Options): Promise<IncomingMessage>;
  19. export function read(response: IncomingMessage, encoding: string): Promise<string|Buffer>;