Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

a simple Hook for making outgoing http requests

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 ReadMe.md
Octocat-spinner-32 config.json
Octocat-spinner-32 package.json
ReadMe.md

hook.io-request

a simple Hook for making outgoing http requests

Installation

 npm install hook.io-request -g

Usage

 hookio-request

Hook Events Names

http::request sends HTTP request:

http::request::result event emitted when request comes back:

http::request::error event emitted when error comes back:

Example

  //
  // options is a 1:1 mapping to https://github.com/mikeal/request API 
  //
  var options = {
    url: "http://google.com/"
  };

  //
  // Make a request with a callback
  //
  //
  hook.emit('http::request', options, function(){
    //console.log('http::request has responded')
  });

Note that the "hook" key contains original parameters passed to request, making it ideal to put some other values for handling the request context (such as linking the request to an id, for example)

Something went wrong with that request. Please try again.