# passer-http

> 基于axios请求封装

Latest version **1.0.2** (published 2020-04-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install passer-http
pnpm add passer-http
yarn add passer-http
bun add passer-http
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2020-04-06 |
| First published | 2020-04-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.1 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| Author | passer |
| Maintainers | yunit_hl |

## Links

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

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.19.2

## Recent versions

- 1.0.2 (latest) — 2020-04-06
- 1.0.1 — 2020-04-04
- 1.0.0 — 2020-04-04

## README

<!--
 * @Description: 描述
 * @Author: lh
 * @Date: 2020-04-02 21:44:59
 -->
# 基于 axios 请求封装

## 说明
  import Http from 'passer-http';

  const http = Http.init({
    axiosConfig: {
      baseURL: '/api'
    },
    errCallback: err => {
      console.log(err, 'err-------');
    },
    resCallback: res => {
      console.log(res, 'res-------');
    }
  });

  Http.init 接收一个对象
  {
    axiosConfig: 创建 axios 实例参数,
    errCallback: axios 响应拦截器统一错误处理回调, 回调参数为 axios 拦截器错误返回,
    resCallback: axios 响应拦截器统一成功处理回调, 回调参数为 axios 拦截器成功返回
  }

  http 实例 支持 get, delete, head, options, post, put, patch 及 cancel(requestId) 手动取消请求, 其中requestId参数为 method + '_' + url 拼接

  请求入参格式:
    http.get(url, {}, config)

    地址, 请求数据, axios请求配置

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