appagent

Send requests to local HTTP servers (http.Server, express, connect or a function) with superagent

npm install appagent
11 downloads in the last month

appagent

Send requests to local HTTP servers (http.Server, express, connect or a function) with superagent.

Inspired by supertest's request(app).method() API.

Installation

Install the appagent and superagent packages from npm. The superagent package should be installed alongside appagent (it is not installed as a dependency of appagent - it expects it to already be installed by a parent package).

$ npm install appagent superagent

Usage

var appagent = require('appagent')
  , app = require('express')();

// Without installing
var request = appagent(app);
request.get('/', function(err, res) { ... });
request.post('/').end(function(err, res) { ... });

// Install as a `client` property of an app
appagent.install(app);
app.client.put('/', ...);

// Or install globally on http.Server prototype, to make it available
// on all apps
appagent.install();

License

MIT

npm loves you