# yr-http

> 基于axios封装的请求库

Latest version **1.0.9** (published 2023-04-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install yr-http
pnpm add yr-http
yarn add yr-http
bun add yr-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.9 |
| Published | 2023-04-20 |
| First published | 2023-01-12 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | jayafs |
| Maintainers | jayafs |
| Keywords | axios, http, request, http请求, axios封装, 请求 |

## Links

- npm: https://www.npmjs.com/package/yr-http
- Repository: https://gitee.com/wuliaodexuanze/yr-http
- Issues: https://gitee.com/wuliaodexuanze/yr-http/issues
- npm.io page: https://npm.io/package/yr-http

## Dependencies (8)

- [qs](https://npm.io/package/qs.md) ^6.11.0
- [axios](https://npm.io/package/axios.md) ^1.3.5
- [prettier](https://npm.io/package/prettier.md) ^2.8.2
- [@types/qs](https://npm.io/package/@types/qs.md) ^6.9.7
- [cross-env](https://npm.io/package/cross-env.md) ^7.0.3
- [es6-promise](https://npm.io/package/es6-promise.md) ^4.2.8
- [tsconfig-paths](https://npm.io/package/tsconfig-paths.md) ^4.1.2
- [eslint-config-prettier](https://npm.io/package/eslint-config-prettier.md) ^8.6.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

- 1.0.9 (latest) — 2023-04-20
- 1.0.8 — 2023-04-20
- 1.0.7 — 2023-04-20
- 1.0.6 — 2023-04-19
- 1.0.5 — 2023-01-13
- 1.0.4 — 2023-01-12
- 1.0.3 — 2023-01-12
- 1.0.1 — 2023-01-12
- 1.0.0 — 2023-01-12

## README

# yr-http

## 参数说明

支持自定义公共 interceptors，包含参数说明：

- requestInterceptors 请求处理
- requestInterceptorsCatch 请求错误处理
- responseInterceptors 响应处理
- responseInterceptorsCatch 响应错误处理

每个请求传递参数支持 interceptors，参数说明

- requestInterceptors 请求处理，会先于 axios 库执行
- responseInterceptors 响应处理，会后于 axios 库执行

其他参数说明

- containHeader 作为请求参数传递，返回信息包含头部信息，默认值 false
- hasNotClearSameRequest 作为请求参数传递，是否不清除同时存在的相同请求，默认是 false

## api 说明

- request 主要请求方法，调用 axios 的 request
- cancelAllRequest 取消全部请求
- cancelRequest 取消单个或指定几个请求，接收参数格式 {url: ''}, [{url: ''}]
- > 说明：传递参数为对象或者对象数组，url 为必传

## 使用

```
npm i yr-http
```

```
import YrGttp from 'yr-http'

const request = new YrGttp()

request.request().then().catch().finally()

```

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