Browse Source

Update readme

master
Forbes Lindesay 10 years ago
parent
commit
edbd92a668
  1. 1
      .travis.yml
  2. 19
      README.md

1
.travis.yml

@ -1,4 +1,3 @@
language: node_js
node_js:
- "0.8"
- "0.10"

19
README.md

@ -10,6 +10,25 @@ A simple object to represent an http response
npm install http-response-object
## Usage
```js
var Response = require('http-response-object');
var res = new Response(200, {}, new Buffer('A ok'));
//res.statusCode === 200
//res.headers === {}
//res.body === new Buffer('A ok')
res.getBody();
// => new Buffer('A ok')
var res = new Response(404, {'Header': 'value'}, new Buffer('Wheres this page'));
//res.statusCode === 404
//res.headers === {header: 'value'}
//res.body === new Buffer('Wheres this page')
res.getBody();
// => throws error with `statusCode`, `headers` and `body` properties.
```
## License
MIT
Loading…
Cancel
Save