A wrapper around a useful node.js library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

sync-request-rapper

A wrapper around a useful node.js library

GUNS DON'T KILL PEOPLE, WRAPPERS DO (I saw it on a documentary on bbc two!)

Build Status Dependency Status NPM version

Installation

npm install sync-request-rapper

Usage

This library is based upon sync request (https://github.com/ForbesLindesay/sync-request), so go there for detailed usage instructions

Basic

request.get(url, options)

e.g.

  • GET request without options
var request = require('sync-request-rapper);
var res = request.get('http://example.com');
console.log(res.getBody());
  • GET request with options
var request = require('sync-request-rapper');
var res = request('https://example.com', {
  'headers': {
    'user-agent': 'example-user-agent'
  }
});
console.log(res.getBody());
  • POST request to a JSON endpoint
var request = require('sync-request-rapper');
var res = request.post('https://example.com/create-user', {
  json: { username: 'RichardWright' }
});
var user = JSON.parse(res.getBody('utf8'));

## License

  MIT