feat(nodejs) added stronger typing for http status codes

This commit is contained in:
basarat
2014-05-23 20:08:56 +10:00
parent 568cb00761
commit dd5499cc0d
2 changed files with 14 additions and 1 deletions
+10
View File
@@ -100,3 +100,13 @@ var request = http.request('http://0.0.0.0');
request.once('error', function () {});
request.setNoDelay(true);
request.abort();
////////////////////////////////////////////////////
/// Http tests : http://nodejs.org/api/http.html
////////////////////////////////////////////////////
module http_tests {
// Status codes
var code = 100;
var codeMessage = http.STATUS_CODES['400'];
var codeMessage = http.STATUS_CODES[400];
}
+4 -1
View File
@@ -348,7 +348,10 @@ declare module "http" {
}
export interface Agent { maxSockets: number; sockets: any; requests: any; }
export var STATUS_CODES: any;
export var STATUS_CODES: {
[errorCode: number]: string;
[errorCode: string]: string;
};
export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server;
export function createClient(port?: number, host?: string): any;
export function request(options: any, callback?: Function): ClientRequest;