Skip to content

Commit

Permalink
docs: move PROTIP elsewhere
Browse files Browse the repository at this point in the history
It does not really belong in its own section, and it unfairly mentions one users suggestion over all of the other great contributions in this README.
  • Loading branch information
RichardLitt authored and gr2m committed Sep 28, 2018
1 parent 7498574 commit 43cf093
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ For instance, if a module performs HTTP requests to a CouchDB server or makes HT
+ [Options](#options-1)
+ [Modes](#modes)
- [Debugging](#debugging)
- [PROTIP](#protip)
- [Contributing](#contributing)
- [Commit Message conventions](#commit-message-conventions)
- [Generate README TOC](#generate-readme-toc)
Expand Down Expand Up @@ -804,6 +803,17 @@ var scope = nock('http:https://api.myservice.com')
.reply(201, 'OK');
```

If you don't want to match the request body you can return a wildcard match:

```js
var scope = nock('http:https://api.myservice.com')
.filteringRequestBody(function(body) {
return '*';
})
.post('/some_uri', '*')
.reply(200, 'OK');
```

### Request Headers Matching

If you need to match requests only if certain request headers match, you can.
Expand Down Expand Up @@ -1404,17 +1414,8 @@ Nock uses debug, so just run with environmental variable DEBUG set to nock.*
$ DEBUG=nock.* node my_test.js
```

## PROTIP

If you don't want to match the request body you can use this trick (by @theycallmeswift):

```js
var scope = nock('http:https://api.myservice.com')
.filteringRequestBody(function(body) {
return '*';
})
.post('/some_uri', '*')
.reply(200, 'OK');
```

## Contributing
Expand Down

0 comments on commit 43cf093

Please sign in to comment.