Skip to content

Commit

Permalink
doc: add a note on JSON arrays (#264)
Browse files Browse the repository at this point in the history
* add a note on JSON arrays

* add note on special chars for JSON keys
  • Loading branch information
nqb authored Jul 14, 2020
1 parent 55f457d commit 5845416
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion executors/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,25 @@ result.error
- result.executor.executor.multipartform: multipartform if exists
- result.err: if exists, this field contains error
- result.body: body of HTTP response
- result.bodyjson: body of HTTP response if it's a json. You can access json data as result.bodyjson.yourkey for example. Note that json keys are lowercased automatically (eg. use result.bodyjson.yourkey, not result.bodyjson.YourKey)
- result.bodyjson: body of HTTP response if it's a JSON. You can access json data as result.bodyjson.yourkey for example.
- result.headers: headers of HTTP response
- result.statuscode: Status Code of HTTP response

### JSON keys

JSON keys are lowercased automatically (eg. use `result.bodyjson.yourkey`, not
`result.bodyjson.YourKey`).

On top of that, if a JSON key contains special characters, they will be translate to underscores.

### JSON arrays

When a HTTP response contains a JSON array, you have to use following syntax
to access specific key of an array: `result.bodyjson.array_name.array_name_index_in_array.key`

Example if you want to get value of `path` key of *second* element in `apis` array: `result.bodyjson.apis.apis1.path`


## Default assertion

```yaml
Expand Down

0 comments on commit 5845416

Please sign in to comment.