npm.io
2.0.0 • Published 3h ago

@hyperttp/interceptors

Licence
MIT
Version
2.0.0
Deps
0
Size
17 kB
Vulns
0
Weekly
0

@hyperttp/interceptors

English | Русский

Request and response interceptor plugin for Hyperttp.

Features

  • Runs user-defined handlers around the Core v2 request lifecycle.
  • Supports request, response, and error interception.
  • Uses protocol-neutral SendRequest, UniversalResponse, and RequestContext values.

Installation

npm install @hyperttp/interceptors
# or
bun add @hyperttp/interceptors

Usage

import { HyperClient } from "hyperttp";
import { withInterceptors } from "@hyperttp/interceptors";

const client = new HyperClient({
  plugins: [withInterceptors({
    onRequest: (request) => request,
  })],
});

See the exported InterceptorsOptions type for available lifecycle callbacks.

License

MIT dirold2

Keywords