meeshkan / unmock-js

Fuzz test your REST API calls
https://unmock.io
93 stars 8 forks source link

Expect CreateResponse to return a serialized response or throw #334

Closed ksaaskil closed 5 years ago

ksaaskil commented 5 years ago

Back in the days CreateResponse was allowed to return undefined, signifying that the user had not properly setup a matcher for the intercepted request. In that case the algorithmic component knew to handle the case and pretty-print instructions for fixing it. In the big monocle-ts refactoring, the response creator was changed to throw an exception if no match was found. As no-one's even noticed that the logic has changed and no pretty-printing is done, I think we can simplify CreateResponse to just return ISerializedResponse or throw.