Skip to content

ForbesLindesay-Unmaintained/request-shared

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

request-shared

Greenkeeper badge

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

About

Logic for normalizing arguments for an http request

Resources

License

Stars

Watchers

Forks

Packages

No packages published