# mock-client-http

> 客户端http mock

Latest version **0.0.4** (published 2016-06-20) · BSD license · 0 weekly downloads

## Install

```sh
npm install mock-client-http
pnpm add mock-client-http
yarn add mock-client-http
bun add mock-client-http
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2016-06-20 |
| First published | 2014-03-30 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | blue68 |
| Maintainers | blune68 |

## Links

- npm: https://www.npmjs.com/package/mock-client-http
- Homepage: https://github.com/blue68/mock-client-http
- Issues: https://github.com/blue68/mock-client-http/issues
- npm.io page: https://npm.io/package/mock-client-http

## Recent versions

- 0.0.4 (latest) — 2016-06-20
- 0.0.3 — 2016-06-20
- 0.0.2 — 2016-06-20
- 0.0.1 — 2014-03-30

## README

# mock-client-http  [![Build Status](https://travis-ci.org/blue68/mock-client-http.svg?branch=master)](https://travis-ci.org/blue68/mock-client-http)


A simulation tool client http



# Install

Install using [npm](https://npmjs.org/package/mock-client-http).

```
npm install mock-client-http --save-dev

```

# Usage

```js

    var mockClientHttp = require('mock-client-http');
    var Test = require('abc'); //需要测试的js, 基于connect 或 express的middleware
    var options = {
        method : 'get',
        url : 'http://localhost:8080/test',
        session : {
            user: {}
        },
        chunks : ['abc'],
        error : {}
    }
    var mock = mockClientHttp(options);
    var test = Test({});
    var _middleware = test.middleware()(mock.req, mock.resp)
    mock.resp.on('end', function(chunks){
      //输出值和期望值比较 
    });

```

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