Skip to content

Commit

Permalink
Readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriiudodov committed Aug 8, 2019
1 parent cdfb3be commit 1885dd4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,28 @@ apiMocker('/api', {
With that option, you can mock only specific urls simply.
## Body parser
By default request body is parsed with help of [body-parser](https://github.com/expressjs/body-parser).
Default configuration uses JSON parser, however you can modify it with help of `bodyParser` object.
`bodyParser` object supports configuration of
- parser type via `type` setting.
- parser options via `options` setting.
Supported parsers and corresponding options can be found [here](https://github.com/expressjs/body-parser#bodyparserjsonoptions)
Example belows configures usage of `text` parser for requests with `content-type=application/vnd.custom-type`
```js
apiMocker('/text', {
target: 'test/mocks',
bodyParser: {
type: 'text',
options: { type: 'application/vnd.custom-type' }
}
})
```
## Logging
If you want to see which requests are being mocked, set the `verbose` option either to `true` or provide your own function.
Expand Down

0 comments on commit 1885dd4

Please sign in to comment.