You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
649 B

4 years ago
  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. }
  15. export function request(url: string, options: Options): Promise<IncomingMessage>;
  16. export function read(response: IncomingMessage, encoding: string): Promise<string|Buffer>;