From 234e7262192b31250e87fcad5f261f00319aaaab Mon Sep 17 00:00:00 2001 From: Thomas Bouldin Date: Fri, 6 Oct 2017 07:21:37 -0700 Subject: [PATCH] Allow option to be a string in Node 6 request methods (#20272) * Add string option to request methods. Per [Node docs](https://nodejs.org/docs/latest-v6.x/api/http.html#http_http_request_options_callback) the `get` and `request` methods should allow the `options` param to be a string. This is true for both the 'https' and 'http' modules. * Add self to "definitions by" per README recommendations --- types/node/v6/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 8e12079d5c..e89656eedf 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Node.js v6.x // Project: http://nodejs.org/ -// Definitions by: Microsoft TypeScript , DefinitelyTyped , Wilco Bakker +// Definitions by: Microsoft TypeScript , DefinitelyTyped , Wilco Bakker , Thomas Bouldin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -798,7 +798,7 @@ declare module "http" { }; export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) => void): Server; export function createClient(port?: number, host?: string): any; - export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; + export function request(options: RequestOptions | string, callback?: (res: IncomingMessage) => void): ClientRequest; export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest; export var globalAgent: Agent; } @@ -1353,8 +1353,8 @@ declare module "https" { }; export interface Server extends tls.Server { } export function createServer(options: ServerOptions, requestListener?: Function): Server; - export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; - export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + export function request(options: RequestOptions | string, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; + export function get(options: RequestOptions | string, callback?: (res: http.IncomingMessage) => void): http.ClientRequest; export var globalAgent: Agent; }