# extra-request

> Utilities for Request

Latest version **11.2.0** (published 2026-05-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install extra-request
pnpm add extra-request
yarn add extra-request
bun add extra-request
```

## Health

**Score 60/100 (C)** — status: active.

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 11.2.0 |
| Published | 2026-05-08 |
| First published | 2020-12-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=22 |
| Dependencies | 6 |
| Unpacked size | 48.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | BlackGlory |
| Maintainers | black_glory |
| Keywords | fetch, Request |

## Links

- npm: https://www.npmjs.com/package/extra-request
- Repository: https://github.com/BlackGlory/extra-request
- Homepage: https://github.com/BlackGlory/extra-request#readme
- Issues: https://github.com/BlackGlory/extra-request/issues
- npm.io page: https://npm.io/package/extra-request

## Dependencies (6)

- [justypes](https://npm.io/package/justypes.md) ^4.4.1
- [js-base64](https://npm.io/package/js-base64.md) ^3.7.7
- [papaparse](https://npm.io/package/papaparse.md) ^5.5.3
- [extra-utils](https://npm.io/package/extra-utils.md) ^6.1.0
- [url-operator](https://npm.io/package/url-operator.md) ^0.3.3
- [@blackglory/prelude](https://npm.io/package/@blackglory/prelude.md) ^0.4.0

## 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

- 11.2.0 (latest) — 2026-05-08
- 11.1.0 — 2026-05-08
- 11.0.2 — 2026-02-15
- 11.0.1 — 2026-02-15
- 11.0.0 — 2026-02-14
- 10.2.1 — 2026-02-14
- 10.2.0 — 2026-02-14
- 10.1.0 — 2025-09-19
- 10.0.0 — 2025-06-15
- 9.0.1 — 2024-12-01
- 9.0.0 — 2024-12-01
- 8.5.5 — 2024-02-21
- 8.5.4 — 2024-02-05
- 8.5.3 — 2024-02-05
- 8.5.2 — 2023-11-05
- … 79 more at https://npm.io/package/extra-request/versions

## README

# extra-request
Utilities for [Request](https://developer.mozilla.org/en-US/docs/Web/API/Request).

## Install
```sh
npm install --save extra-request
# or
yarn add extra-request
```

## Usage
```ts
import { post } from 'extra-request'
import { url, json } from 'extra-request/transformers'

const req = post(
  url('http://example.com')
, json({ hello: 'world' })
)
const res = await fetch(req)
```

## API
```ts
interface IRequestOptions {
  url: URL
  headers: Headers
  payload?: BodyInit
  signal?: AbortSignal
  keepalive?: boolean
  redirect?: RequestRedirect
  cache?: RequestCache
  priority?: RequestPriority
}

type IRequestOptionsTransformer = (options: IRequestOptions) => RequestOptions
```

### get
```ts
function get(...transformers: Array<IRequestOptionsTransformer | Falsy>): Request
```

### head
```ts
function head(...transformers: Array<IRequestOptionsTransformer | Falsy>: Request
```

### post
```ts
function post(...transformers: Array<IRequestOptionsTransformer | Falsy>): Request
```

### put
```ts
function put(...transformers: Array<IRequestOptionsTransformer | Falsy>): Request
```

### patch
```ts
function patch(...transformers: Array<IRequestOptionsTransformer | Falsy>): Request
```

### del
```ts
function del(...transformers: Array<IRequestOptionsTrransformer | Falsy>): Request
```

### request
```ts
function request(
  method: 'GET' | 'HEAD' | 'PUT' | 'POST' | 'PATCH' | 'DELETE'
, ...transformers: Array<IRequestOptionsTransformer | Falsy>
): Request
```

### pipeRequestOptionsTransformers
```ts
function pipeRequestOptionsTransformers(
  ...transformers: Array<IRequestOptionsTransformer | Falsy>
): IRequestOptions
```

### Transformers
#### url
```ts
function url(...urls: NonEmptyArray<string | URL>): IRequestOptionsTransformer
```

#### text
```ts
function text(payload: string): IRequestOptionsTransformer
```

#### json
```ts
function json<T extends JSONValue | JSONSerializable<any>>(
  payload: T
): IRequestOptionsTransformer
```

#### csv
```ts
function csv<Field extends string>(
  header: NonEmptyArray<Field>
, data: Array<Record<Field, number | string>>
): IRequestOptionsTransformer
```

#### signal
```ts
function signal(signal: AbortSignal): IRequestOptionsTransformer
```

#### header
```ts
function header(name: string, value: string): IRequestOptionsTransformer
```

#### appendHeader
```ts
function appendHeader(name: string, value: string): IRequestOptionsTransformer
```

#### headers
```ts
function headers<T extends Record<string, string>>(
  headers: T
): IRequestOptionsTransformer
```

#### host
```ts
function host(host: string): IRequestOptionsTransformer
```

#### hostname
```ts
function hostname(hostname: string): IRequestOptionsTransformer
```

#### port
```ts
function port(port: number): IRequestOptionsTransformer
```

#### pathname
```ts
function pathname(pathname: string): IRequestOptionsTransformer
```

#### appendPathname
```ts
function appendPathname(pathname: string): IRequestOptionsTransformer
```

#### search
```ts
function search(search: string): IRequestOptionsTransformer
```

#### searchParam
```ts
function searchParam(
  name: string
, value: string | number
): IRequestOptionsTransformer
```

#### appendSearchParam
```ts
function appendSearchParam(
  name: string
, value: string | number
): IRequestOptionsTransformer
```

#### searchParams
```ts
function searchParams<T extends Record<string, string | number | undefined>>(
  searchParams: T
): IRequestOptionsTransformer
```

#### formDataField
```ts
function formDataField(
  name: string
, value: string | string[] | Blob
): IRequestOptionsTransformer
```

#### basicAuth
```ts
function basicAuth(username: string, password: string): IRequestOptionsTransformer
```

#### bearerAuth
```ts
function bearerAuth(token: string): IRequestOptionsTransformer
```

#### keepalive
```ts
function keepalive(keepalive: boolean = true): IRequestOptionsTransformer
```

#### redirect
```ts
function redirect(redirect: RequestRedirect): IRequestOptionsTransformer
```

#### body
```ts
function body(body: BodyInit): IRequestOptionsTransformer
```

#### cache
```ts
function cache(cache: RequestCache): IRequestOptionsTransformer
```

#### priority
```ts
function priority(priority: RequestPriority): IRequestOptionsTransformer
```

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