gstroup / apimocker

node.js module to run a simple http server for mock service responses.
MIT License
280 stars 81 forks source link

Added body filtering based on raw body, or provided hash. #102

Closed thejonan closed 5 years ago

thejonan commented 5 years ago

In certain condition, it would help to be able to filter mock responses, based on the provided body content - without bothering to inspect all parsed values (switches), or even when the body is not parsable at all.

In order to be able to handle complex and/or big bodies, comparing against its hash is provided as an option. The (matching) hash is provided in the mock configuration and when a request comes, the actual body's hash is compared against it. All hashing algorithms provided by crypto module are usable.