Request plugin for Architect


request plugin for architect

  "packagePath": "./node_modules/architect-request"

Go to town on that sucker

module.exports = function (optionsimportsregister) {
  var request = imports.request;
  request('', function(errorresponsebody){
    // handle the response 

It would be nice to create a fixure for request testing.

We would be able to define routes similar to express:

var requestSpoof = new request.fixture();
requestSpoof.get('', req, res) {
  res.send(JSON.encode({hello: "world"}));

We can set up our tests like this:

var imports = {
  request: requestSpoof
require('other-plugin')({}, imports, register);

And in a test case:

it('should consume the api', function(done)) {
  // This module would make a call to '' and 
  // parse the returned json