# promise-http

> A simple promise-based HTTP Client that is aware of HTTP status codes

Latest version **0.1.5** (published 2014-09-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install promise-http
pnpm add promise-http
yarn add promise-http
bun add promise-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2014-09-25 |
| First published | 2014-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Abed Halawi |
| Maintainers | vinelab |
| Keywords | http, client, promise |

## Links

- npm: https://www.npmjs.com/package/promise-http
- Repository: https://github.com/Vinelab/node-promise-http
- Issues: https://github.com/Vinelab/node-promise-http/issues
- npm.io page: https://npm.io/package/promise-http

## Dependencies (2)

- [q](https://npm.io/package/q.md) ~2.0.2
- [q-io](https://npm.io/package/q-io.md) 2.0.6

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.1.5 (latest) — 2014-09-25
- 0.1.4 — 2014-09-25
- 0.1.3 — 2014-09-14
- 0.1.2 — 2014-08-16
- 0.1.1 — 2014-08-15
- 0.1.0 — 2014-08-13

## README

![Travis-CI Status](https://travis-ci.org/Vinelab/node-promise-http.svg?branch=master)

# Promise HTTP

A simple wrapper for [q-io/http](https://github.com/kriskowal/q-io#requestrequest-object-or-url)
that handles erroneous responses and rejects the promise accordingly.

## Installation

`npm install promise-http --save`

## Usage

> The request can be anything that compatible with [q-io/http#request](https://github.com/kriskowal/q-io#requestrequest-object-or-url)

### GET

```javascript
Http = require('Http').client

request = Http.get('http://some.url').then(function(response){
   // you got the data
});

request.then(function(response){
    // done
}, function(reason){
    // something went wrong
});
```

### POST

```javascript
Http = require('Http').client

Http.post('http://some.url').then(function(response){
    // you know what to do...
});

request = Http.post({
    url: 'http://some.url',
    body: ['text'],
    headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});

request.then(function(response){
    // all good.
});

request.fail(function(reason){
    // nope.
})
```

---
_Source: https://npm.io/package/promise-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
