# @aster-js/http

> Aster http client library part of Aster js library

Latest version **1.0.2** (published 2024-01-14) · ISC license · 0 weekly downloads

## Install

```sh
npm install @aster-js/http
pnpm add @aster-js/http
yarn add @aster-js/http
bun add @aster-js/http
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-01-14 |
| First published | 2021-01-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 36.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | sebdoucet |
| Maintainers | aster-js |

## Links

- npm: https://www.npmjs.com/package/@aster-js/http
- Repository: https://github.com/asterlibraryjs/aster-js-http
- Homepage: https://github.com/asterlibraryjs/aster-js-http#readme
- Issues: https://github.com/asterlibraryjs/aster-js-http/issues
- npm.io page: https://npm.io/package/@aster-js/http

## Dependencies (3)

- [tslib](https://npm.io/package/tslib.md) ^2.6.2
- [@aster-js/core](https://npm.io/package/@aster-js/core.md) ^1.3.0
- [@aster-js/async](https://npm.io/package/@aster-js/async.md) ^1.4.0

## Recent versions

- 1.0.2 (latest) — 2024-01-14
- 1.0.1 — 2022-06-01
- 1.0.0 — 2022-05-31
- 1.0.0-beta.2 — 2021-01-18
- 1.0.0-beta.1 — 2021-01-18

## README

# @aster-js/http

## Main concept

This library introduce an `HttpClient` that works using an execution pipeline through chain of `IRequestHandler`.

It also use a core concept of `@aster-js/async`: `AbortToken`. They are used through the pipeline allowing to cancel any pipeline that still run.

```ts
// You can provide your own root RequestHandler, very use full for Unit Testing
const httpClient = new HttpClient()
    // Sync or async configuration
    .configure(async options => {
        options.headers = {
            "Content-Type": await AuthorizationManager.getToken()
        };
    })
    // Multiple RequestHandler implementation:
    // timeout, caching, dynamic configuration or custom implementations
    .pipe(TimeoutRequestHandler, 30 * 1000);



httpClient.get("/data", HttpBody.json())
```

## Resiliency

[@aster-js/resilient](https://github.com/asterlibraryjs/aster-js-resilient#readme) provide a `ResilientRequestHandler` that provide advance way to handle retrys.

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