request-shared

0.0.1 • Public • Published

request-shared

Logic for normalizing arguments for an http request

Build Status Dependency Status NPM version

Installation

npm install request-shared

Request

var Request = require('request-shared').Request;
var req = new Request('http://www.example.com', {method: 'post'});

Response

var Response = require('request-shared').Response;
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

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.10latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.10

Package Sidebar

Install

npm i request-shared

Weekly Downloads

0

Version

0.0.1

License

MIT

Last publish

Collaborators

  • forbeslindesay