# sealui-request

> SealUI Request

Latest version **1.0.2** (published 2019-05-24) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2019-05-24 |
| First published | 2019-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 77.1 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | 听着情歌流泪 |
| Maintainers | bobo.xiao |
| Keywords | sealui-request, SealUI, Request |

## Links

- npm: https://www.npmjs.com/package/sealui-request
- Repository: https://github.com/SealUI/seal
- Homepage: https://github.com/SealUI/seal/tree/master/packages/sealui-request#readme
- Issues: https://github.com/SealUI/seal/issues
- npm.io page: https://npm.io/package/sealui-request

## Dependencies (1)

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

## Recent versions

- 1.0.2 (latest) — 2019-05-24
- 1.0.1 — 2019-05-04
- 1.0.0 — 2019-05-04

## README

# `sealui-request`

## Usage

```
import sealuiRequest from 'sealui-request'

sealuiRequest({
  url:'xxxxx',
  data: {
    x: 1,
    y: 2
  },
  retry: 1,
  retryDelay: 2000
  }
}).then(res => {
  console.log(res)
}, err => {
  console.log(err)
})

sealuiRequest({
  url:'xxxxx',
  data: {
    x: 1,
    y: 2
  },
  success: (res) => {
    console.log(res)
  },
  fail: (err) => {
    console.log(err)
  }
})
```

## API

| 参数       | 说明      | 类型       | 默认值       | 可选值       |
|-----------|-----------|-----------|-------------|-------------|
| url | 请求的URL地址 | string | — | — |
| method | HTTP 请求方法 | string | GET | POST、PUT、DELETE、PATCH |
| data | 请求的参数 | object | — | — |
| header | 设置请求的 header，header 中不能设置 Referer。content-type 默认为 application/x-www-form-urlencoded | object | — | — |
| dataType | 返回的数据格式 | string | json | — |
| retry | 请求失败后的重试次数 | number | 3 | — |
| retryDelay | 请求失败后的重试间隔 (毫秒) | number | 2000 | — |
| dataType | 数据类型 | string | json | — |
| timeOut | 请求超时时长 (毫秒) | number | 5000 | — |
| withCredentials | 是否跨域请求 | boolean | false | — |
| beforeRequest | 请求拦截器 | function | — | — |
| afterRequest | 响应拦截器 | function | — | — |
| success | 请求成功切有数据返回 | function | — | — |
| fail | 请求失败 | function | — | — |
| complete | 请求完成，不管是成功还是失败，都会执行 | function | — | — |

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