From bbf7d433237a5e8eb455e74bbd561f614eea9f15 Mon Sep 17 00:00:00 2001 From: Samuel Marks Date: Wed, 28 Sep 2016 22:42:23 +1000 Subject: [PATCH] http.ServerRequest => http.IncomingMessage (#11500) --- acl/acl.d.ts | 2 +- applicationinsights/applicationinsights.d.ts | 8 ++++---- browser-sync/browser-sync.d.ts | 4 ++-- bufferstream/bufferstream.d.ts | 2 +- busboy/busboy-tests.ts | 2 +- express-serve-static-core/express-serve-static-core.d.ts | 2 +- formidable/formidable-tests.ts | 2 +- multiparty/multiparty-tests.ts | 2 +- multiparty/multiparty.d.ts | 2 +- on-headers/on-headers-tests.ts | 2 +- restify/restify.d.ts | 2 +- urlrouter/urlrouter.d.ts | 2 +- ws/ws-tests.ts | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/acl/acl.d.ts b/acl/acl.d.ts index d222f9ebb6..eaa728cb2c 100644 --- a/acl/acl.d.ts +++ b/acl/acl.d.ts @@ -20,7 +20,7 @@ declare module "acl" { type Callback = (err: Error) => any; type AnyCallback = (err: Error, obj: any) => any; type AllowedCallback = (err: Error, allowed: boolean) => any; - type GetUserId = (req: http.ServerRequest, res: http.ServerResponse) => Value; + type GetUserId = (req: http.IncomingMessage, res: http.ServerResponse) => Value; interface AclStatic { new (backend: Backend, logger: Logger, options: Option): Acl; diff --git a/applicationinsights/applicationinsights.d.ts b/applicationinsights/applicationinsights.d.ts index 96d5773fa5..45c89556a6 100644 --- a/applicationinsights/applicationinsights.d.ts +++ b/applicationinsights/applicationinsights.d.ts @@ -346,24 +346,24 @@ interface Client { * Log an incoming http request to your server. The request data will be tracked during the response "finish" event if it is successful or the request "error" * event if it fails. The request duration is automatically calculated as the timespan between when the trackRequest method was called, and when the response "finish" * or request "error" events were fired. - * @param request The http.ServerRequest object to track + * @param request The http.IncomingMessage object to track * @param response The http.ServerResponse object for this request * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. */ - trackRequest(request: any /* http.ServerRequest */, response: any /* http.ServerResponse */, properties?: { + trackRequest(request: any /* http.IncomingMessage */, response: any /* http.ServerResponse */, properties?: { [key: string]: string; }): void; /** * Log an incoming http request to your server. The request data is tracked synchronously rather than waiting for the response "finish"" or request "error"" events. * Use this if you need your request telemetry to respect custom app insights operation and user context (for example if you set any appInsights.client.context.tags). - * @param request The http.ServerRequest object to track + * @param request The http.IncomingMessage object to track * @param response The http.ServerResponse object for this request * @param ellapsedMilliseconds The duration for this request. Defaults to 0. * @param properties map[string, string] - additional data used to filter requests in the portal. Defaults to empty. * @param error An error that was returned for this request if it was unsuccessful. Defaults to null. */ - trackRequestSync(request: any /*http.ServerRequest */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: { + trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: { [key: string]: string;}, error?: any) : void; /** diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 00d234f958..54b42aff4a 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -288,11 +288,11 @@ declare module "browser-sync" { middleware?: MiddlewareHandler; ws: boolean; reqHeaders: (config: any) => Hash; - proxyRes: (res: http.ServerResponse, req: http.ServerRequest, next: Function) => any; + proxyRes: (res: http.ServerResponse, req: http.IncomingMessage, next: Function) => any; } interface MiddlewareHandler { - (req: http.ServerRequest, res: http.ServerResponse, next: Function): any; + (req: http.IncomingMessage, res: http.ServerResponse, next: Function): any; } interface PerRouteMiddleware { diff --git a/bufferstream/bufferstream.d.ts b/bufferstream/bufferstream.d.ts index ee115d0ab5..c43a716d4b 100644 --- a/bufferstream/bufferstream.d.ts +++ b/bufferstream/bufferstream.d.ts @@ -104,7 +104,7 @@ declare module 'bufferstream/postbuffer' { http client buffer */ - constructor(req: http.ServerRequest); + constructor(req: http.IncomingMessage); /* set a callback to get all post data from a http server request */ diff --git a/busboy/busboy-tests.ts b/busboy/busboy-tests.ts index 058b5c92d3..11e8b6c9ad 100644 --- a/busboy/busboy-tests.ts +++ b/busboy/busboy-tests.ts @@ -5,7 +5,7 @@ import * as Busboy from 'busboy'; import * as http from 'http'; import * as util from 'util'; -function serverFn(req: http.ServerRequest, res: http.ServerResponse) { +function serverFn(req: http.IncomingMessage, res: http.ServerResponse) { if (req.method === 'POST') { var busboy = new Busboy({ headers: req.headers }); busboy.on('file', function(fieldname, file, filename, encoding, mimetype) { diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts index 0371c2bb6a..648f1447a5 100644 --- a/express-serve-static-core/express-serve-static-core.d.ts +++ b/express-serve-static-core/express-serve-static-core.d.ts @@ -130,7 +130,7 @@ declare module "express-serve-static-core" { interface Errback { (err: Error): void; } - interface Request extends http.ServerRequest, Express.Request { + interface Request extends http.IncomingMessage, Express.Request { /** * Return request header. diff --git a/formidable/formidable-tests.ts b/formidable/formidable-tests.ts index a0f70a713c..4fdc5ba4cf 100644 --- a/formidable/formidable-tests.ts +++ b/formidable/formidable-tests.ts @@ -48,7 +48,7 @@ if (form.bytesReceived > 100) { if (form.bytesExpected > 100) { } -var req: http.ServerRequest; +var req: http.IncomingMessage; form.parse(req); form.parse(req, (err: any, fields: formidable.Fields, files: formidable.Files) => { diff --git a/multiparty/multiparty-tests.ts b/multiparty/multiparty-tests.ts index 47e6a62f71..e84320ca46 100644 --- a/multiparty/multiparty-tests.ts +++ b/multiparty/multiparty-tests.ts @@ -4,7 +4,7 @@ import multiparty = require('multiparty'); import http = require('http'); import util = require('util'); -http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) { +http.createServer(function (req: http.IncomingMessage, res: http.ServerResponse) { if (req.url === '/upload' && req.method === 'POST') { var count = 0; var form = new multiparty.Form(); diff --git a/multiparty/multiparty.d.ts b/multiparty/multiparty.d.ts index a280c366f8..b0977ff034 100644 --- a/multiparty/multiparty.d.ts +++ b/multiparty/multiparty.d.ts @@ -18,7 +18,7 @@ declare module "multiparty" { * @param request * @param callback */ - parse(request: http.ServerRequest, callback?: (error: Error, fields: any, files: any) => any): void; + parse(request: http.IncomingMessage, callback?: (error: Error, fields: any, files: any) => any): void; } export interface File { diff --git a/on-headers/on-headers-tests.ts b/on-headers/on-headers-tests.ts index 11f33c4ef0..35b62764ed 100644 --- a/on-headers/on-headers-tests.ts +++ b/on-headers/on-headers-tests.ts @@ -6,7 +6,7 @@ import onHeaders = require('on-headers') http.createServer(onRequest) .listen(3000); -function onRequest(req: http.ServerRequest, res: http.ServerResponse) { +function onRequest(req: http.IncomingMessage, res: http.ServerResponse) { onHeaders(res, addPoweredBy); res.setHeader('Content-Type', 'text/plain') res.end('hello!'); diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 65b3f44d47..5f6ca472b1 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -35,7 +35,7 @@ declare module "restify" { } } - interface Request extends http.ServerRequest { + interface Request extends http.IncomingMessage { /** * builds an absolute URI for the request. * @private diff --git a/urlrouter/urlrouter.d.ts b/urlrouter/urlrouter.d.ts index c7a741ac90..0a1fff0d4c 100644 --- a/urlrouter/urlrouter.d.ts +++ b/urlrouter/urlrouter.d.ts @@ -13,7 +13,7 @@ declare module "urlrouter" { namespace UrlRouterInternal { - interface ServerRequest extends http.ServerRequest { + interface ServerRequest extends http.IncomingMessage { params: any; } diff --git a/ws/ws-tests.ts b/ws/ws-tests.ts index 3c85d678cb..4afa12bfe8 100644 --- a/ws/ws-tests.ts +++ b/ws/ws-tests.ts @@ -66,7 +66,7 @@ var WebSocketServer = WebSocket.Server; info: { origin: string secure: boolean - req: http.ServerRequest + req: http.IncomingMessage } , callback: (res: boolean) => void ): void {