# http-load-test

> Complete endpoint load test

Latest version **0.3.0** (published 2022-04-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install http-load-test
pnpm add http-load-test
yarn add http-load-test
bun add http-load-test
```

## 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.3.0 |
| Published | 2022-04-25 |
| First published | 2020-06-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | mrtcmn |

## Links

- npm: https://www.npmjs.com/package/http-load-test
- Repository: https://github.com/mrtcmn/http-load-test
- Homepage: https://github.com/mrtcmn/http-load-test#readme
- Issues: https://github.com/mrtcmn/http-load-test/issues
- npm.io page: https://npm.io/package/http-load-test

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^0.26.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.21

## Recent versions

- 0.3.0 (latest) — 2022-04-25
- 0.2.2 — 2022-04-20
- 0.2.1 — 2022-02-14
- 0.2.0 — 2022-01-11
- 0.1.0 — 2021-11-02
- 0.0.4 — 2021-11-02
- 0.0.3 — 2020-06-10
- 0.0.2 — 2020-06-09
- 0.0.1 — 2020-06-09

## README

# http-load-test (Alpha)

[![npm version](https://badge.fury.io/js/http-load-test.svg)](https://badge.fury.io/js/http-load-test)

Complete endpoint load test.

## Installation

Choose to favorite package manager and install `http-load-test` package.

`npm install http-load-test`

or

`yarn install http-load-test`

## Basic Usage

```javascript
const HttpLoadTest = require('http-load-test');

let job = new HttpLoadTest({
  url: 'http://localhost:8001/test', // Enpoint Url
  totalRequest: 10, // How many request what you want as TOTAL
  psRequest: 1, // How many request you want for PER SECOND
  method: 'post', // Http methods
  data: { // Body
    test: "test2"
  },
  headers: {
    'CustomHeaderKey': 'CustomHeaderValue',
    'content-type': 'application/json', 
  },
  requestConfig: { // All axios request configs can apply here 
    responseType: 'json',
  }
})

job.startTest(); // For starting to http load test.

```

## Methods

`setRequestSuccessChecker`

If result success related response's body, or status code, setRequestSuccessChecker method can be used for purpose.

Example:
```javascript
httpLoadInstance.setRequestSuccessChecker((response) => {
  try {
    if (response.data.dc === 'Success') {
      return true;
    }
  } catch {
    return false;
  }
  return false;
});
```

`setDynamicDataFunction`

With this method, different data can be generated for each request.

```javascript
httpLoadInstance.setDynamicDataFunction(() => ( {
  test: Date.now().toString()
}));
```


##TODO's

If you want to contribute feel to free for join. Open issue. 

- [x] Support other http methods.
- [x] Body and header append
- [x] Allow to all axios options.
- [ ] Custom success response function
- [ ] Advanced statistics such as http ms, total time etc.
- [ ] Handling all error codes and append total report

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