JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1241478
  • Score
    100M100P100Q185650F
  • License MIT

A simple object to represent an http response

Package Exports

  • http-response-object

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-response-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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