# promise-success

> this is a encapsulation based on urllib, it only call Fulfilled when the status === 200

Latest version **2.0.3** (published 2016-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install promise-success
pnpm add promise-success
yarn add promise-success
bun add promise-success
```

## 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 | 2.0.3 |
| Published | 2016-05-16 |
| First published | 2016-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | danlanxiaohei |
| Maintainers | danlanxiaohei |
| Keywords | urllib, promise, http, request |

## Links

- npm: https://www.npmjs.com/package/promise-success
- Repository: https://github.com/danlanxiaohei/promise-success
- Homepage: https://github.com/danlanxiaohei/promise-success#readme
- Issues: https://github.com/danlanxiaohei/promise-success/issues
- npm.io page: https://npm.io/package/promise-success

## Dependencies (2)

- [urllib](https://npm.io/package/urllib.md) ^2.9.0
- [agentkeepalive](https://npm.io/package/agentkeepalive.md) ^2.1.1

## 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

- 2.0.3 (latest) — 2016-05-16
- 2.0.2 — 2016-05-16
- 2.0.1 — 2016-05-13
- 2.0.0 — 2016-05-13

## README

<!-- [![npm version](https://badge.fury.io/js/urllib-promise.svg)](https://badge.fury.io/js/promise-success)
[![Build Status](https://travis-ci.org/danlanxiaohei/urllib-promise.svg?branch=master)](https://travis-ci.org/danlanxiaohei/promise-success) -->
# promise-success
目标：封装公司现有请求：

请求返回200：resolve，附带经过JSON.parse()后的数据。

其他情况一律：reject，并附带JSON.parse()后的数据(如果有的话)和请求的 statusCode。

## Install
```bash
$ npm install promise-success --save
```
## Usage
```js

'use strict';

var koa = require('koa');
var app = koa();
var request = require('promise-success');

app.use(function *(){
  try {
    var result = yield request('https://www.baidu.com');
    this.body = result;
  } catch (e) {
    this.body = e;
  }
});

app.listen(8000);


```

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