mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
nodemailer: fetch returns Writable with extra properties
This commit is contained in:
8
types/nodemailer/lib/fetch/index.d.ts
vendored
8
types/nodemailer/lib/fetch/index.d.ts
vendored
@@ -4,12 +4,18 @@ type ms = number;
|
||||
|
||||
import _Cookies = require('./cookies');
|
||||
|
||||
import * as http from 'http';
|
||||
import { Writable } from 'stream';
|
||||
import * as tls from 'tls';
|
||||
|
||||
declare namespace fetch {
|
||||
type Cookies = _Cookies;
|
||||
|
||||
interface WritableResponse extends Writable {
|
||||
statusCode: number;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
fetchRes?: Writable;
|
||||
cookies?: Cookies;
|
||||
@@ -27,6 +33,6 @@ declare namespace fetch {
|
||||
}
|
||||
}
|
||||
|
||||
declare function fetch(url: string, options?: fetch.Options): Writable;
|
||||
declare function fetch(url: string, options?: fetch.Options): fetch.WritableResponse;
|
||||
|
||||
export = fetch;
|
||||
|
||||
@@ -1090,7 +1090,11 @@ function base64_test() {
|
||||
// fetch
|
||||
|
||||
function fetch_test() {
|
||||
fetch('http://localhost/');
|
||||
const stream = fetch('http://localhost/');
|
||||
|
||||
const statusCode: number = stream.statusCode;
|
||||
const headers = stream.headers;
|
||||
const contentType: string | undefined = headers['content-type'];
|
||||
|
||||
fetch('http://localhost:/', {
|
||||
allowErrorResponse: true,
|
||||
|
||||
Reference in New Issue
Block a user