You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Forbes Lindesay 80a0ea8211 1.0.1 10 years ago
test Initial code 10 years ago
.gitignore Initial code 10 years ago
.travis.yml Update readme 10 years ago
LICENSE Initial code 10 years ago
README.md touch 10 years ago
index.js Support encoding 10 years ago
package.json 1.0.1 10 years ago

README.md

http-response-object

A simple object to represent an http response

Build Status Dependency Status NPM version

Installation

npm install http-response-object

Usage

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