# http-task

> Modern, promise & task based http client for nodejs

Latest version **1.0.2** (published 2021-04-17) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-04-17 |
| First published | 2021-03-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 56.4 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Abdallah Zidan |
| Maintainers | abdallah-zidan |

## Links

- npm: https://www.npmjs.com/package/http-task
- npm.io page: https://npm.io/package/http-task

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.21.1

## Recent versions

- 1.0.2 (latest) — 2021-04-17
- 1.0.1 — 2021-03-20
- 1.0.0 — 2021-03-20

## README

# http-task

Modern, promise & task based http client for nodejs

## Table of Contents

- [Features](#features)
- [Installing](#installing)
- [Examples](#examples)
- [Task vs Promise](#task)
- [Credits](#credits)
- [License](#license)

## Features

- Send http requests as promises or tasks
- Conversion from tasks back to promise
- Useful operators for response transformation
- Parsing json responses
- informative error message.
- [New] task based requests for advanced control [task mapping, chaining , concurrency]
- It uses axios so it supports all what axios supports

## Installing

- Not there yet but will be as following

Using npm:

```bash
$ npm install http-task
```

Using yarn:

```bash
$ yarn add http-task
```

## Examples

```js
// promise based
const { request, sendRequest, Types, Request } = require("http-task");

// this approach allows for configuring and sending the request later
let r = request({
  url: "https://jsonplaceholder.typicode.com/todos/1",
  enableDefaultInterceptors: true,
});

r.allowUnauthorized()
  .setContentType(Types.XML)
  .send()
  .then(console.log)
  .catch(console.log);

// or alternatively

sendRequest({
  url: "https://jsonplaceholder.typicode.com/todos/1",
  enableDefaultInterceptors: true,
  allowUnauthorized: true,
  headers: {
    "Content-Type": Types.XML,
  },
})
  .then(console.log)
  .catch(console.log);

// fork a new request from previous one's configurations
Request.from(r)
  .addConfig({
    url: "<different url>",
  })
  .send()
  .then(console.log)
  .catch(console.log);
```

## Todo

    - more examples coming

## Credits

    - Abd Allah Zidan

## License

    - MIT

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