# testx-http-keywords

> Keywords to send simple http requests and check the responses using the testx library.

Latest version **0.14.5** (published 2018-04-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install testx-http-keywords
pnpm add testx-http-keywords
yarn add testx-http-keywords
bun add testx-http-keywords
```

## 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.14.5 |
| Published | 2018-04-04 |
| First published | 2015-09-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 (+12 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Greyarch BV |
| Maintainers | greyarch, jeroenp |
| Keywords | http, test, testx |

## Links

- npm: https://www.npmjs.com/package/testx-http-keywords
- Repository: http://www.github.com/greyarch/testx-http-keywords
- npm.io page: https://npm.io/package/testx-http-keywords

## Dependencies (7)

- [xpath](https://npm.io/package/xpath.md) 0.0.24
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [xmldom](https://npm.io/package/xmldom.md) ^0.1.27
- [request](https://npm.io/package/request.md) ^2.73.0
- [coffee-errors](https://npm.io/package/coffee-errors.md) ^0.8.6
- [jsonpath-plus](https://npm.io/package/jsonpath-plus.md) ^0.15.0
- [parse-key-value](https://npm.io/package/parse-key-value.md) ^1.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.14.5 (latest) — 2018-04-04
- 0.14.4 — 2017-11-28
- 0.14.3 — 2017-10-19
- 0.14.2 — 2017-10-02
- 0.14.1 — 2017-10-02
- 0.14.0 — 2017-08-02
- 0.13.1 — 2017-05-17
- 0.13.0 — 2017-05-16
- 0.12.0 — 2017-04-05
- 0.11.1 — 2017-04-05
- 0.11.0 — 2017-04-04
- 0.10.0 — 2017-03-06
- 0.9.1 — 2016-12-21
- 0.9.0 — 2016-12-21
- 0.8.1 — 2016-12-13
- … 12 more at https://npm.io/package/testx-http-keywords/versions

## README

testx-http-keywords
=====

A library that extends testx with keywords for sending basic http requests. This library is packaged as a npm package

## How does it work
From the directory of the art code install the package as follows:
```sh
npm install testx-http-keywords --save
```

After installing the package add the keywords to your protractor config file as follows:

```
testx.keywords.add(require('testx-http-keywords'))
```

## Keywords

| Keyword                   | Argument name | Argument value  | Description | Supports repeating arguments |
| ----------------------    | ------------- | --------------- |------------ | ---------------------------- |
| send http [optional request method] request         |               |                 | send a http POST request and check if the response status code is 200 |  |
|                           | url           | relative url to which the request will be sent || No |
|                           | method        | request method  | Optional. Valid values are **get**, **post**, **put**, **delete**, **patch** and **head**. Defaults to **get**. It is also possible to put the method in the keyword, as in **send http post request** or **send http delete request** instead of providing this argument. | No |
|                           | json          | a valid JSON string that contains the body of the request, will make the Content-Type of the request 'application/json' | Optional. Cannot use it together with **body**. | No |
|                           | body          | a string that contains the body of the request | Optional. Cannot use it together with **json**. | No |
|                           | headers       | custom headers | Optional. Semicolon or new line-separated string of '='-separated key-value pairs. For example "User-Agent=testx;Something-Else='value with spaces'"| No |
|                           | expected status code   | expected status code of the response | Optional. The test will fail if the actual status code is different; defaults to 200| No |
|                           | expected response  | expected content of the response | Optional. The test will fail if the actual content (body) of the response is not equal. | No |
|                           | expected response regex | a regex to match against the response | Optional. The keyword will try to match the provided regular expression against the content (body) of the response and will fail if there is no match; currently it is not possible to provide regex matching options. | No |
|                           | expected headers | list of expected response headers | Optional. Same format as the *headers* parameter. The keyword will fail if not all of the expected response headers exist or if they have values different than the expected/specified onesble to provide regex matching options. | No |
|                           | *json path/xpath* | *expected value at this json path or xpath* | Optional. Depending on the **Content-Type** header this argument will be treated as JSON path or an XPath. The argument name should be the actual path, i.e. "$.address.city" or "//address/city". | Yes |
|                           | expected missing json paths | list of expected missing json paths | Optional. The keyword will fail if one of the expected response headers exist | No |
|                           | expected present json paths | list of expected present json paths | Optional. The keyword will fail if one of the expected response headers does not exist | No |

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