Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

architect-request

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

architect-request

Request plugin for Architect

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

architect-request

request plugin for architect

Config Format

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

Usage

Go to town on that sucker

module.exports = function (options, imports, register) {

  var request = imports.request;

  request('http://google.com', function(error, response, body){
    // handle the response
  });

};

TODO

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('http://api.example.com', 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 'http://api.example.com' and
  // parse the returned json
  moduleThatDependsOnRequest.get(function(err, obj){
    should.not.exist(err);
    should.exist(obj);
    should.exist(obj.hello);
    obj.hello.should.equal("world");
  });
}

FAQs

Package last updated on 21 Aug 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc