Skip to content

Commit

Permalink
docs(README): Add encodedQueryParams option to docs. (#1537)
Browse files Browse the repository at this point in the history
Identified as missing here #1514 (comment).

This option seems to have been added to better support how the
recorder saves and plays back. But as it is a valid, public option it
should be documented.
  • Loading branch information
mastermatt authored and gr2m committed May 2, 2019
1 parent ef5ecbc commit 86c5c4f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,16 @@ nock('http://example.com')
.reply(200, { results: [{ id: 'pgte' }] })
```

A query string that is already [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding) can be
matched by passing the `encodedQueryParams` flag in the options when creating the Scope.

```js
nock('http://example.com', { encodedQueryParams: true })
.get('/users')
.query('foo%5Bbar%5D%3Dhello%20world%21')
.reply(200, { results: [{ id: 'pgte' }] })
```

### Specifying replies

You can specify the return status code for a path on the first argument of reply like this:
Expand Down

0 comments on commit 86c5c4f

Please sign in to comment.