# wz_request

> 基于axios封装的请求工具

Latest version **1.0.1** (published 2022-12-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install wz_request
pnpm add wz_request
yarn add wz_request
bun add wz_request
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-12-26 |
| First published | 2022-12-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 321.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Z |
| Maintainers | z_npm |
| Keywords | axios, fetch, request, normalize |

## Links

- npm: https://www.npmjs.com/package/wz_request
- npm.io page: https://npm.io/package/wz_request

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^1.2.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.1 (latest) — 2022-12-26
- 1.0.0 — 2022-12-26

## README

# wz_request

#### 介绍
基于axios封装的请求工具


#### 安装

```bash
npm install wz_request
```

#### 使用说明

##### Request

```js
import { Request } from 'wz_request';

// 创建一个 request 实例， 自定义拦截器功能
const request = new Request({}, {
  interceptRequest: (config) => {
    config.headers.Authorization = token;
  },
  interceptResponse: (res) => {
    if (res.data.code !== 200) {
      message.error(res.data.msg);
    }
  }
});

// 使用规范化的请求
const res = await request.normalizeGet(url, ops)
if (res.success) {
  // do success
} else {
  // do error
}


// 使用常规请求同axios
request.get(url, ops)
  .then(res => {
    
  })
  .catch(err => {

  })
```

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