Permalink
Browse files

Convert to 2 spaces

  • Loading branch information...
1 parent e81bf5f commit 32154725dd09efb046ce0971d3bd601c4ff146f7 @wdavidw committed Nov 13, 2012
Showing with 155 additions and 153 deletions.
  1. +20 −20 README.md
  2. +3 −1 lib/index.js
  3. +28 −28 package.json
  4. +101 −101 src/index.coffee
  5. +3 −3 test/index.coffee
View
40 README.md
@@ -9,35 +9,35 @@ Utility to interact with HTTP status code.
### API sample
```javascript
- var HTTPStatus = require('http-status');
+ var HTTPStatus = require('http-status');
- // Print "Internal Server Error"
- console.log(HTTPStatus[500]);
+ // Print "Internal Server Error"
+ console.log(HTTPStatus[500]);
- // Print 500
- console.log(HTTPStatus.INTERNAL_SERVER_ERROR);
+ // Print 500
+ console.log(HTTPStatus.INTERNAL_SERVER_ERROR);
```
### Express sample
```javascript
- var express = require('express'),
- redis = require('redis'),
- HTTPStatus = require('http-status');
-
- var app = express.createServer();
-
- app.get('/', function (req, res) {
- var client = redis.createClient();
- client.ping(function (err, msg) {
- if (err) {
- return res.send(HTTPStatus.INTERNAL_SERVER_ERROR);
- }
- res.send(msg, HTTPStatus.OK);
- });
+ var express = require('express'),
+ redis = require('redis'),
+ HTTPStatus = require('http-status');
+
+ var app = express.createServer();
+
+ app.get('/', function (req, res) {
+ var client = redis.createClient();
+ client.ping(function (err, msg) {
+ if (err) {
+ return res.send(HTTPStatus.INTERNAL_SERVER_ERROR);
+ }
+ res.send(msg, HTTPStatus.OK);
});
+ });
- app.listen(3000);
+ app.listen(3000);
```
Contributors
View
4 lib/index.js
@@ -1,3 +1,5 @@
+// Generated by CoffeeScript 1.4.0
+
module.exports = {
100: 'Continue',
101: 'Switching Protocols',
@@ -79,4 +81,4 @@ module.exports = {
SERVICE_UNAVAILABLE: 503,
GATEWAY_TIMEOUT: 504,
HTTP_VERSION_NOT_SUPPORTED: 505
-};
+};
View
56 package.json
@@ -1,30 +1,30 @@
{
- "name": "http-status",
- "description": "Interact with HTTP status code",
- "keywords": ["http", "express", "connect"],
- "version": "0.1.1",
- "homepage": "http://www.adaltas.com/projects/node-http-status.html",
- "author": "David Worms <david@adaltas.com>",
- "repository": {
- "type": "git",
- "url": "https://github.com/wdavidw/node-http-status"
- },
- "bugs": {
- "email": "open@adaltas.com",
- "url": "http://github.com/wdavidw/node-http-status/issues"
- },
- "devDependencies": {
- "coffee-script": "latest",
- "mocha": "latest",
- "should": "latest"
- },
- "contributors": [
- { "name": "David Worms", "email": "david@adaltas.com" },
- { "name": "Daniel Gasienica", "email": "daniel@gasienica.ch"}
- ],
- "main": "./lib",
- "engines": { "node": ">= 0.4.0" },
- "scripts": {
- "test": "mocha"
- }
+ "name": "http-status",
+ "description": "Interact with HTTP status code",
+ "keywords": ["http", "express", "connect"],
+ "version": "0.1.1",
+ "homepage": "http://www.adaltas.com/projects/node-http-status.html",
+ "author": "David Worms <david@adaltas.com>",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/wdavidw/node-http-status"
+ },
+ "bugs": {
+ "email": "open@adaltas.com",
+ "url": "http://github.com/wdavidw/node-http-status/issues"
+ },
+ "devDependencies": {
+ "coffee-script": "latest",
+ "mocha": "latest",
+ "should": "latest"
+ },
+ "contributors": [
+ { "name": "David Worms", "email": "david@adaltas.com" },
+ { "name": "Daniel Gasienica", "email": "daniel@gasienica.ch"}
+ ],
+ "main": "./lib",
+ "engines": { "node": ">= 0.4.0" },
+ "scripts": {
+ "test": "mocha"
+ }
}
View
202 src/index.coffee
@@ -3,113 +3,113 @@
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1
module.exports =
- # Informational 1xx
- # Request received, continuing process
- 100: 'Continue'
- 101: 'Switching Protocols'
+ # Informational 1xx
+ # Request received, continuing process
+ 100: 'Continue'
+ 101: 'Switching Protocols'
- # Successful 2xx
- # The action was successfully received, understood, and accepted
- 200: 'OK'
- 201: 'Created'
- 202: 'Accepted'
- 203: 'Non-Authoritative Information'
- 204: 'No Content'
- 205: 'Reset Content'
- 206: 'Partial Content'
+ # Successful 2xx
+ # The action was successfully received, understood, and accepted
+ 200: 'OK'
+ 201: 'Created'
+ 202: 'Accepted'
+ 203: 'Non-Authoritative Information'
+ 204: 'No Content'
+ 205: 'Reset Content'
+ 206: 'Partial Content'
- # Redirection 3xx
- # Further action must be taken in order to complete the request
- 300: 'Multiple Choices'
- 301: 'Moved Permanently'
- 302: 'Found'
- 303: 'See Other'
- 304: 'Not Modified'
- 305: 'Use Proxy'
- 307: 'Temporary Redirect'
+ # Redirection 3xx
+ # Further action must be taken in order to complete the request
+ 300: 'Multiple Choices'
+ 301: 'Moved Permanently'
+ 302: 'Found'
+ 303: 'See Other'
+ 304: 'Not Modified'
+ 305: 'Use Proxy'
+ 307: 'Temporary Redirect'
- # Client Error 4xx
- # The request contains bad syntax or cannot be fulfilled
- 400: 'Bad Request'
- 401: 'Unauthorized'
- 402: 'Payment Required'
- 403: 'Forbidden'
- 404: 'Not Found'
- 405: 'Method Not Allowed'
- 406: 'Not Acceptable'
- 407: 'Proxy Authentication Required'
- 408: 'Request Time-out'
- 409: 'Conflict'
- 410: 'Gone'
- 411: 'Length Required'
- 412: 'Precondition Failed'
- 413: 'Request Entity Too Large'
- 414: 'Request-URI Too Large'
- 415: 'Unsupported Media Type'
- 416: 'Requested range not satisfiable'
- 417: 'Expectation Failed'
+ # Client Error 4xx
+ # The request contains bad syntax or cannot be fulfilled
+ 400: 'Bad Request'
+ 401: 'Unauthorized'
+ 402: 'Payment Required'
+ 403: 'Forbidden'
+ 404: 'Not Found'
+ 405: 'Method Not Allowed'
+ 406: 'Not Acceptable'
+ 407: 'Proxy Authentication Required'
+ 408: 'Request Time-out'
+ 409: 'Conflict'
+ 410: 'Gone'
+ 411: 'Length Required'
+ 412: 'Precondition Failed'
+ 413: 'Request Entity Too Large'
+ 414: 'Request-URI Too Large'
+ 415: 'Unsupported Media Type'
+ 416: 'Requested range not satisfiable'
+ 417: 'Expectation Failed'
- # Server Error 5xx
- # The server failed to fulfill an apparently valid request
- 500: 'Internal Server Error'
- 501: 'Not Implemented'
- 502: 'Bad Gateway'
- 503: 'Service Unavailable'
- 504: 'Gateway Time-out'
- 505: 'HTTP Version not supported'
+ # Server Error 5xx
+ # The server failed to fulfill an apparently valid request
+ 500: 'Internal Server Error'
+ 501: 'Not Implemented'
+ 502: 'Bad Gateway'
+ 503: 'Service Unavailable'
+ 504: 'Gateway Time-out'
+ 505: 'HTTP Version not supported'
- # Informational 1xx
- # Request received, continuing process
- CONTINUE: 100
- SWITCHING_PROTOCOLS: 101
+ # Informational 1xx
+ # Request received, continuing process
+ CONTINUE: 100
+ SWITCHING_PROTOCOLS: 101
- # Successful 2xx
- # The action was successfully received, understood, and accepted
- OK: 200
- CREATED: 201
- ACCEPTED: 202
- NON_AUTHORITATIVE_INFORMATION: 203
- NO_CONTENT: 204
- RESET_CONTENT: 205
- PARTIAL_CONTENT: 206
+ # Successful 2xx
+ # The action was successfully received, understood, and accepted
+ OK: 200
+ CREATED: 201
+ ACCEPTED: 202
+ NON_AUTHORITATIVE_INFORMATION: 203
+ NO_CONTENT: 204
+ RESET_CONTENT: 205
+ PARTIAL_CONTENT: 206
- # Redirection 3xx
- # Further action must be taken in order to complete the request
- MULTITPLE_CHOICES: 300
- MOVED_PERMAMENTLY: 301
- FOUND: 302
- SEE_OTHER: 303
- NOT_MODIFIED: 304
- USE_PROXY: 305
- # Unused: 306 (reserved)
- TEMPORARY_REDIRECT: 307
+ # Redirection 3xx
+ # Further action must be taken in order to complete the request
+ MULTITPLE_CHOICES: 300
+ MOVED_PERMAMENTLY: 301
+ FOUND: 302
+ SEE_OTHER: 303
+ NOT_MODIFIED: 304
+ USE_PROXY: 305
+ # Unused: 306 (reserved)
+ TEMPORARY_REDIRECT: 307
- # Client Error 4xx
- # The request contains bad syntax or cannot be fulfilled
- BAD_REQUEST: 400
- UNAUTHORIZED: 401
- PAYMENT_REQUIRED: 402
- FORBIDDEN: 403
- NOT_FOUND: 404
- METHOD_NOT_ALLOWED: 405
- NOT_ACCEPTABLE: 406
- PROXY_AUTHENTICATION_REQUIRED: 407
- REQUEST_TIMEOUT: 408
- CONFLICT: 409
- GONE: 410
- LENGTH_REQUIRED: 411
- PRECONDITION_FAILED: 412
- REQUEST_ENTITY_TOO_LARGE: 413
- REQUEST_URI_TOO_LONG: 414
- UNSUPPORTED_MEDIA_TYPE: 415
- REQUESTED_RANGE_NOT_SATISFIABLE: 416
- EXPECTATION_FAILED: 417
+ # Client Error 4xx
+ # The request contains bad syntax or cannot be fulfilled
+ BAD_REQUEST: 400
+ UNAUTHORIZED: 401
+ PAYMENT_REQUIRED: 402
+ FORBIDDEN: 403
+ NOT_FOUND: 404
+ METHOD_NOT_ALLOWED: 405
+ NOT_ACCEPTABLE: 406
+ PROXY_AUTHENTICATION_REQUIRED: 407
+ REQUEST_TIMEOUT: 408
+ CONFLICT: 409
+ GONE: 410
+ LENGTH_REQUIRED: 411
+ PRECONDITION_FAILED: 412
+ REQUEST_ENTITY_TOO_LARGE: 413
+ REQUEST_URI_TOO_LONG: 414
+ UNSUPPORTED_MEDIA_TYPE: 415
+ REQUESTED_RANGE_NOT_SATISFIABLE: 416
+ EXPECTATION_FAILED: 417
- # Server Error 5xx
- # The server failed to fulfill an apparently valid request
- INTERNAL_SERVER_ERROR: 500
- NOT_IMPLEMENTED: 501
- BAD_GATEWAY: 502
- SERVICE_UNAVAILABLE: 503
- GATEWAY_TIMEOUT: 504
- HTTP_VERSION_NOT_SUPPORTED: 505
+ # Server Error 5xx
+ # The server failed to fulfill an apparently valid request
+ INTERNAL_SERVER_ERROR: 500
+ NOT_IMPLEMENTED: 501
+ BAD_GATEWAY: 502
+ SERVICE_UNAVAILABLE: 503
+ GATEWAY_TIMEOUT: 504
+ HTTP_VERSION_NOT_SUPPORTED: 505
View
6 test/index.coffee
@@ -4,6 +4,6 @@ status = require '..'
describe 'HTTP Status', ->
- it 'should return code and message', ->
- status.OK.should.eql 200
- status[200].should.eql 'OK'
+ it 'should return code and message', ->
+ status.OK.should.eql 200
+ status[200].should.eql 'OK'

0 comments on commit 3215472

Please sign in to comment.