# yyl-request

> request with promise type

Latest version **0.1.1** (published 2019-07-10) · ISC license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2019-07-10 |
| First published | 2019-01-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 8.0.0 |
| Dependencies | 1 |
| Unpacked size | 11 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | jackness |
| Maintainers | jackness |
| Keywords | request, promise |

## Links

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

## Dependencies (1)

- [request](https://npm.io/package/request.md) ^2.88.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 0.1.1 (latest) — 2019-07-10
- 0.1.0 — 2019-01-13

## README

# yyl-request
对 [request](https://github.com/request/request) 组件进行 promise 封装， 对最后一个 callback 参数进行改造

## install
```
npm i yyl-request --save
```

## 引用
```
const extRequest = require('yyl-request');
const request = extRequest.origin;
```

## API
### extRequest.origin
```
/**
 * @return {Function} request
 */
extRequest.origin
```

### extRequest(url);
```
/**
 * @param  {String}  url              请求地址
 * @return {Promise} [err, res, body]
 * @param {Error}    err              请求错误对象
 * @param {Object}   res              返回的 response 对象
 * @param {body}     body             返回的 请求 body 内容
 */
extRequest(url);
```

### extRequest(opt);
opt 参数具体参考 [这里](https://github.com/request/request#multipartrelated)
```
/**
 * @param  {String}  opt              请求参数
 * @return {Promise} [err, res, body]
 * @param {Error}    err              请求错误对象
 * @param {Object}   res              返回的 response 对象
 * @param {body}     body             返回的 请求 body 内容
 */
extRequest(opt);
```

### extRequest.post(url);

```
/**
 * post 请求
 * @param  {String}  url              请求地址
 * @return {Promise} [err, res, body]
 * @param {Error}    err              请求错误对象
 * @param {Object}   res              返回的 response 对象
 * @param {body}     body             返回的 请求 body 内容
 */
extRequest.post(url);
```

### extRequest.post(url, opt);
opt 参数 具体参考 [这里](https://github.com/request/request#forms)

```
/**
 * post 请求
 * @param  {String}  url              请求地址
 * @param  {Object}  opt              参数
 * @return {Promise} [err, res, body]
 * @param {Error}    err              请求错误对象
 * @param {Object}                    返回的 response 对象
 * @param {body}                      返回的 请求 body 内容
 */
extRequest.post(url, opt);
```

### extRequest.get(url, opt);
opt 参数 具体参考 [这里](https://github.com/request/request#forms)
```
/**
 * get 请求
 * @param  {String}  url              请求地址
 * @param  {Object}  opt              参数
 * @return {Promise} [err, res, body]
 * @param {Error}    err              请求错误对象
 * @param {Object}                    返回的 response 对象
 * @param {body}                      返回的 请求 body 内容
 */
extRequest.get(url, opt);
```

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