# @open-pioneer/http

> Provides the HttpService, which can be used to request resources over HTTP.

Latest version **4.10.0** (published 2026-11-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @open-pioneer/http
pnpm add @open-pioneer/http
yarn add @open-pioneer/http
bun add @open-pioneer/http
```

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 4.10.0 |
| Published | 2026-11-19 |
| First published | 2023-06-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 2 |
| Unpacked size | 30.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 4 |
| Maintainers | mbeckem_conterra, jessebluemr, antoniave_conterra, open_pioneer |
| Keywords | open-pioneer-trails |

## Links

- npm: https://www.npmjs.com/package/@open-pioneer/http
- Repository: https://github.com/open-pioneer/trails-core-packages
- Homepage: https://github.com/open-pioneer
- npm.io page: https://npm.io/package/@open-pioneer/http

## Dependencies (2)

- [@open-pioneer/core](https://npm.io/package/@open-pioneer/core.md) 4.10.0
- [@open-pioneer/runtime](https://npm.io/package/@open-pioneer/runtime.md) 4.10.0

## Recent versions

- 4.10.0 (latest) — 2026-11-19
- 4.10.0-dev.20261119090001 (dev) — 2026-11-19
- 4.7.1-dev-test-snapshot-123.20260821142246 (dev-test-snapshot-123) — 2026-08-21
- 4.7.1-dev-test-snapshot.20260821120534 (dev-test-snapshot) — 2026-08-21
- 4.9.0 — 2026-10-30
- 4.9.0-dev.20261029090037 — 2026-10-29
- 4.9.0-dev.20261002130116 — 2026-10-02
- 4.9.0-dev.20260930055642 — 2026-09-30
- 4.8.0 — 2026-09-17
- 4.8.0-dev.20260910101405 — 2026-09-10
- 4.7.0 — 2026-07-28
- 4.7.0-dev.20260727091735 — 2026-07-27
- 4.7.0-dev.20260713101438 — 2026-07-13
- 4.7.0-dev-test-snapshot.20260707113553 — 2026-07-07
- 4.7.0-dev-test-snapshot.20260707113111 — 2026-07-07
- … 95 more at https://npm.io/package/@open-pioneer/http/versions

## README

# @open-pioneer/http

This package provides the `HttpService`, which can be used to request resources over HTTP.

## Usage

To use the HTTP service, reference the interface `http.HttpService` from your service as in the following sample:

```js
// build.config.mjs
import { defineBuildConfig } from "@open-pioneer/build-support";

export default defineBuildConfig({
    services: {
        MyService: {
            references: {
                httpService: "http.HttpService"
            }
        }
        // ...
    }
    // ...
});
```

From the implementation class of `MyService`, call `fetch()` on the service:

```js
// MyService.js
export class MyService {
    constructor(serviceOptions) {
        this.httpService = serviceOptions.references.httpService;
    }

    async myMethod() {
        const response = await this.httpService.fetch(/* ... */);
    }
}
```

The signature of the `fetch()` method is compatible to the Browser's global [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) function.
However, the `HttpService`'s method should be preferred to take advantage of future features (such as logging or proxy support).

### Request interceptors

> The request interceptor API is experimental: it may change with a new minor release as a response to feedback.

The `HttpService` supports extension via _request interceptors_.
Request interceptors can modify requests (query parameters, headers, etc.) before they are sent to the server.

To register a request interceptor, implement a service that provides `"http.Interceptor"`:

```js
// build.config.mjs
import { defineBuildConfig } from "@open-pioneer/build-support";

export default defineBuildConfig({
    services: {
        ExampleInterceptor: {
            provides: "http.Interceptor"
        }
        // ...
    }
    // ...
});
```

```ts
// ExampleInterceptor.ts
import { Interceptor, BeforeRequestParams } from "@open-pioneer/http";
export class ExampleInterceptor implements Interceptor {
    async beforeRequest?(params: BeforeRequestParams) {
        // Invoked for every request. See API documentation for more details.
    }
}
```

## License

Apache-2.0 (see `LICENSE` file)

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