assaf / node-replay

When API testing slows you down: record and replay HTTP responses like a boss
http://documentup.com/assaf/node-replay
MIT License
522 stars 107 forks source link

Need finer mechanism for POST testing #148

Closed ggb667 closed 6 years ago

ggb667 commented 6 years ago

Testing posts where the body is slightly different from request to request causes things to not match, and the workaround is to throw away the entire request body.

Lets say you have a request whose body is json and includes an id field, or a timestamp. At present you can only get the json to match by deleting the body element from the recording. That's a pretty blunt instrument and won't work if you need to call the same service more than once.

ggb667 commented 6 years ago

This is resolved in https://github.com/assaf/node-replay/pull/145

If you choose to integrate that pull request (I hope you do), please mention in the docs that the regular expression is in /whateverTheRegexIs/ format (an expression within slashes. An example might be nice. In my case we were using strong-loopback, and had to look for WhateverTypeWeWant, and ignore the changing timestamp and session id.