appagent

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

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

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

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
var appagent = require('appagent')
  , app = require('express')();
 
// Without installing 
var request = appagent(app);
request.get('/', function(errres) { ... });
request.post('/').end(function(errres) { ... });
 
// 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();

MIT