request-shared
Logic for normalizing arguments for an http request
Last updated 11 years ago by forbeslindesay .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install request-shared 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.1                                ...           latest (11 years ago)

1 Versions

  • 0.0.1                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
  • qs 0.6.6
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |