Skip to content
Abstract HTTP Request for Browsers and Node.js
JavaScript Shell
Find file
Pull request Compare This branch is 24 commits ahead, 123 commits behind v2.2.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.jshintrc
README.md
anr-request.js
anr-response.js
anr.js
http-json.js
http-shortcuts.js
http-text.js
package.json
test.js

README.md

Abstract HTTP Request

AHR is a middleware framework for http clients (Browser and NodeJS).

Think connect, but for clients.

API

  • AHR.create()
  • AHR#http()
    • request
    • response
  • AHR#use()
  • AHR#extend()

Example

var ahr = require('ahr')
  , client
  , request
  ;

client = ahr.create()
  .extend(ahr.Http())
  .use(ahr.json())
  ;

req = client.get("http://foobar3000.com/echo/example.json");
req.on('complete', function (data) {
});

req.on('progress', function () {
  // whatever
});
req.on('data', function () {
  // whatever
});
req.on('end', function () {
  // whatever
});
req.on('response', function (res) {
  res.on('progress', function () {
    // whatever
  });
  res.on('data', function () {
    // whatever
  });
  res.on('end', function () {
    // whatever
  });
});
Something went wrong with that request. Please try again.