requestah

lean http wrapper that makes unit testing REST apps a bit less rough

requestah

lean HTTP wrapper for node.js that makes unit testing your REST services a bit easier.

Usage:

var requestah = require('requestah');
requestah = new requestah(80); // Use any port you want

// Basic HTTP GET:
requestah.get('/users', function(response) {
    if (response.statusCode === 200) { console.log(response.body); }
});

// HTTP POST with data:
requestah.post('/users', {name: "John Doe"}, function(response) {
    if (response.statusCode === 200) { console.log(response.body); }
});

// HTTP DELETE with headers:
requestah.del('/users/john', {headers: {authkey: "b4080ca70d561714e3245f6ed4b8d243"}}, function(response) {
    if (response.statusCode === 204) { console.log(response.body); }
});

// HTTP PUT with data & headers:
requestah.put('/users/john', {name: "Jane Doe", headers: {authkey: "b4080ca70d561714e3245f6ed4b8d243"}}, function(response) {
    if (response.statusCode === 204) { console.log(response.body); }
});


// External HTTP GET:
requestah.get('http://www.google.com', function(response) {
    if (response.statusCode === 200) { console.log(response.body); }
});

See LICENSE file.

Copyright (c) 2012 Joakim Brantingson