Add library http-status

This commit is contained in:
Michael Zabka 2015-03-23 18:45:53 +01:00
parent 32f0a90dab
commit e60ccd8a23
2 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,91 @@
/// <reference path="http-status.d.ts" />
import httpStatus = require('http-status');
var str: string;
var nmr: number;
str = httpStatus[100];
str = httpStatus[101];
str = httpStatus[200];
str = httpStatus[201];
str = httpStatus[202];
str = httpStatus[203];
str = httpStatus[204];
str = httpStatus[205];
str = httpStatus[206];
str = httpStatus[300];
str = httpStatus[301];
str = httpStatus[302];
str = httpStatus[303];
str = httpStatus[304];
str = httpStatus[305];
str = httpStatus[307];
str = httpStatus[400];
str = httpStatus[401];
str = httpStatus[402];
str = httpStatus[403];
str = httpStatus[404];
str = httpStatus[405];
str = httpStatus[406];
str = httpStatus[407];
str = httpStatus[408];
str = httpStatus[409];
str = httpStatus[410];
str = httpStatus[411];
str = httpStatus[412];
str = httpStatus[413];
str = httpStatus[414];
str = httpStatus[415];
str = httpStatus[416];
str = httpStatus[417];
str = httpStatus[429];
str = httpStatus[500];
str = httpStatus[501];
str = httpStatus[502];
str = httpStatus[503];
str = httpStatus[504];
str = httpStatus[505];
nmr = httpStatus.CONTINUE;
nmr = httpStatus.SWITCHING_PROTOCOLS;
nmr = httpStatus.OK;
nmr = httpStatus.CREATED;
nmr = httpStatus.ACCEPTED;
nmr = httpStatus.NON_AUTHORITATIVE_INFORMATION;
nmr = httpStatus.NO_CONTENT;
nmr = httpStatus.RESET_CONTENT;
nmr = httpStatus.PARTIAL_CONTENT;
nmr = httpStatus.MULTIPLE_CHOICES;
nmr = httpStatus.MOVED_PERMANENTLY;
nmr = httpStatus.FOUND;
nmr = httpStatus.SEE_OTHER;
nmr = httpStatus.NOT_MODIFIED;
nmr = httpStatus.USE_PROXY;
nmr = httpStatus.TEMPORARY_REDIRECT;
nmr = httpStatus.BAD_REQUEST;
nmr = httpStatus.UNAUTHORIZED;
nmr = httpStatus.PAYMENT_REQUIRED;
nmr = httpStatus.FORBIDDEN;
nmr = httpStatus.NOT_FOUND;
nmr = httpStatus.METHOD_NOT_ALLOWED;
nmr = httpStatus.NOT_ACCEPTABLE;
nmr = httpStatus.PROXY_AUTHENTICATION_REQUIRED;
nmr = httpStatus.REQUEST_TIMEOUT;
nmr = httpStatus.CONFLICT;
nmr = httpStatus.GONE;
nmr = httpStatus.LENGTH_REQUIRED;
nmr = httpStatus.PRECONDITION_FAILED;
nmr = httpStatus.REQUEST_ENTITY_TOO_LARGE;
nmr = httpStatus.REQUEST_URI_TOO_LONG;
nmr = httpStatus.UNSUPPORTED_MEDIA_TYPE;
nmr = httpStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
nmr = httpStatus.EXPECTATION_FAILED;
nmr = httpStatus.TOO_MANY_REQUESTS;
nmr = httpStatus.INTERNAL_SERVER_ERROR;
nmr = httpStatus.NOT_IMPLEMENTED;
nmr = httpStatus.BAD_GATEWAY;
nmr = httpStatus.SERVICE_UNAVAILABLE;
nmr = httpStatus.GATEWAY_TIMEOUT;
nmr = httpStatus.HTTP_VERSION_NOT_SUPPORTED;

95
http-status/http-status.d.ts vendored Normal file
View File

@ -0,0 +1,95 @@
// Type definitions for http-status v0.1.8
// Project: https://github.com/wdavidw/node-http-status
// Definitions by: Michael Zabka <https://github.com/misak113/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface HttpStatus {
100: string;
101: string;
200: string;
201: string;
202: string;
203: string;
204: string;
205: string;
206: string;
300: string;
301: string;
302: string;
303: string;
304: string;
305: string;
307: string;
400: string;
401: string;
402: string;
403: string;
404: string;
405: string;
406: string;
407: string;
408: string;
409: string;
410: string;
411: string;
412: string;
413: string;
414: string;
415: string;
416: string;
417: string;
429: string;
500: string;
501: string;
502: string;
503: string;
504: string;
505: string;
CONTINUE: number;
SWITCHING_PROTOCOLS: number;
OK: number;
CREATED: number;
ACCEPTED: number;
NON_AUTHORITATIVE_INFORMATION: number;
NO_CONTENT: number;
RESET_CONTENT: number;
PARTIAL_CONTENT: number;
MULTIPLE_CHOICES: number;
MOVED_PERMANENTLY: number;
FOUND: number;
SEE_OTHER: number;
NOT_MODIFIED: number;
USE_PROXY: number;
TEMPORARY_REDIRECT: number;
BAD_REQUEST: number;
UNAUTHORIZED: number;
PAYMENT_REQUIRED: number;
FORBIDDEN: number;
NOT_FOUND: number;
METHOD_NOT_ALLOWED: number;
NOT_ACCEPTABLE: number;
PROXY_AUTHENTICATION_REQUIRED: number;
REQUEST_TIMEOUT: number;
CONFLICT: number;
GONE: number;
LENGTH_REQUIRED: number;
PRECONDITION_FAILED: number;
REQUEST_ENTITY_TOO_LARGE: number;
REQUEST_URI_TOO_LONG: number;
UNSUPPORTED_MEDIA_TYPE: number;
REQUESTED_RANGE_NOT_SATISFIABLE: number;
EXPECTATION_FAILED: number;
TOO_MANY_REQUESTS: number;
INTERNAL_SERVER_ERROR: number;
NOT_IMPLEMENTED: number;
BAD_GATEWAY: number;
SERVICE_UNAVAILABLE: number;
GATEWAY_TIMEOUT: number;
HTTP_VERSION_NOT_SUPPORTED: number
}
declare var httpStatus: HttpStatus;
declare module 'http-status' {
export = httpStatus;
}