node package manager
Stop wasting time. Easily manage code sharing in your team. Create a free org »


Build Status


PromiseHttpClient is a simple promise-based HTTP client based on Q and Q-IO, and provides a nicer approach to dealing with asynchronous requests. Results from HTTP requests are standard Q promises.

Current features:

  • Supports GET, PUT, POST and DELETE verbs
  • Supports JSON requests and responses, with automatic marshalling and unmarshalling

See the TODO section below for the list of features not currently supported


Use npm to add the library as a dependency to your project:

```npm install --save promise-http-client``


How to retrieve the frontpage using the library:

var PromiseHttpClient = require("promisehttpclient"),
    client = new PromiseHttpClient();
client.get("").then(function(body) {
}).fail(function(err) {
    console.log("There was an error retrieving the page: " + err);

See the examples/ folder for additional examples, including a JSON client.


Use grunt test to run the unit tests.

Unit tests are built with Nock (, so the client is not hitting a live HTTP server but instead a mocked one, which means that there may be real world scenarios where the client does not work as expected. Feel free to report an issue for cases where the behaviour of the client is incorrect.


The following features are in the roadmap:

  • Support for HTTP 302 redirects
  • Implement the remaining HTTP methods (OPTIONS, PATCH, etc)
  • Gzipped requests and responses


Apache License 2.0: