# wiremock-client

> A node client for interfacing with WireMock's admin API

Latest version **1.0.36** (published 2019-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install wiremock-client
pnpm add wiremock-client
yarn add wiremock-client
bun add wiremock-client
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.36 |
| Published | 2019-01-31 |
| First published | 2018-09-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 99.7 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | Alex Brown |
| Maintainers | alexmb522 |

## Links

- npm: https://www.npmjs.com/package/wiremock-client
- npm.io page: https://npm.io/package/wiremock-client

## Dependencies (1)

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

## Recent versions

- 1.0.36 (latest) — 2019-01-31
- 1.0.35 — 2018-10-03
- 1.0.33 — 2018-09-19
- 1.0.31 — 2018-09-18
- 1.0.30 — 2018-09-18
- 1.0.29 — 2018-09-18
- 1.0.28 — 2018-09-18
- 1.0.26 — 2018-09-13
- 1.0.25 — 2018-09-13
- 1.0.24 — 2018-09-13
- 1.0.22 — 2018-09-12
- 1.0.21 — 2018-09-12
- 1.0.19 — 2018-09-12
- 1.0.18 — 2018-09-12
- 1.0.10 — 2018-09-12
- … 7 more at https://npm.io/package/wiremock-client/versions

## README

# WireMock Client

[![npm version](https://badge.fury.io/js/wiremock-client.svg)](https://badge.fury.io/js/wiremock-client)
[![Build Status](https://travis-ci.org/alexmbrown/wiremock-client.svg?branch=master)](https://travis-ci.org/alexmbrown/wiremock-client)
[![Coverage Status](https://coveralls.io/repos/github/alexmbrown/wiremock-client/badge.svg?branch=master)](https://coveralls.io/github/alexmbrown/wiremock-client?branch=master)
[![Maintainability](https://api.codeclimate.com/v1/badges/ed209ea9824605912120/maintainability)](https://codeclimate.com/github/alexmbrown/wiremock-client/maintainability)

A node client for interfacing with WireMock's admin API

**WARNING: THIS LIBRARY CURRENTLY EXPERIMENTAL AND IN A PRE-ALPHA STATE**

### Node Example
```javascript
const {Builders, Matchers, connect} = require('wiremock-client')

const mock = connect('localhost', 8080)
mock.register(Builders.post(Matchers.urlPathMatching('/api/example'))
  .withRequestBody(Matchers.containsPattern('token=auth'))
  .willReturn(Builders.aResponse()
    .withStatus(200)
    .withHeader('Content-Type', Matchers.equalTo('application/json'))
    .withBody({test: true})
  )
)
```

### Browser Example
```html
<script src="wiremock-client.js"></script>
```

```javascript
const Builders =  WireMock.Builders
const Matchers =  WireMock.Matchers

const mock = WireMock.connect('localhost', 8080)
mock.register(Builders.post(Matchers.urlPathMatching('/api/example'))
  .withRequestBody(Matchers.containsPattern('token=auth'))
  .willReturn(Builders.aResponse()
    .withStatus(200)
    .withHeader('Content-Type', Matchers.equalTo('application/json'))
    .withBody({test: true})
  )
)
```

## Features

### Matchers

#### Url Matchers

These matchers are used for matching request urls

##### Url Matching
```
urlMatching (url)
```
---

urlPattern (pattern)

---

urlPathMatching (path)

---
```
urlPathPattern (pattern)
```
---

#### Global Matchers

containsPattern(pattern)
equalTo(value)

### Mappings
Stub mappings


Get all stub mapping
 
```
wireMock.getStubMapping(uuid) 
```
---
Create new stub mapping
 
```
wireMock.register(mappingBuilder|mapping)
```
---
Delete all mapping
 
```
wireMock.removeMappings()
```
---
Delete all mapping
 
```
wireMock.removeMappings()
```
---
Reset stub mappings 

---
Get a single stub mapping

---
Delete a stub mapping

---
Save all persistent stub mappings to the backing store

---
Find stubs by matching on their metadata

---
Remove stubs by matching on their metadata

---


### Requests
### Recordings
### scenarios
### Near Misses
### Settings
### Shutdown

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