http.d.ts 894 B

123456789101112131415161718192021222324252627
  1. /// <reference types="node" />
  2. import http from 'http';
  3. import https from 'https';
  4. import { Readable } from 'stream';
  5. import { UrlWithStringQuery } from 'url';
  6. import { GetUriOptions } from '.';
  7. declare type HttpOrHttpsModule = typeof http | typeof https;
  8. export interface HttpReadableProps {
  9. date?: number;
  10. parsed?: UrlWithStringQuery;
  11. redirects?: HttpReadable[];
  12. }
  13. export interface HttpReadable extends Readable, HttpReadableProps {
  14. }
  15. export interface HttpIncomingMessage extends http.IncomingMessage, HttpReadableProps {
  16. }
  17. export interface HttpOptions extends GetUriOptions, https.RequestOptions {
  18. cache?: HttpReadable;
  19. http?: HttpOrHttpsModule;
  20. redirects?: HttpReadable[];
  21. maxRedirects?: number;
  22. }
  23. /**
  24. * Returns a Readable stream from an "http:" URI.
  25. */
  26. export default function get(parsed: UrlWithStringQuery, opts: HttpOptions): Promise<Readable>;
  27. export {};