Handling the response when Hoverfly cannot match
Last updated
Last updated
You will notice that when Hoverfly cannot match you will get a 502 Bad Gateway along with a detailed Hoverfly Error in the response Body.
This is good for debugging, but when you are running the simulations in a live environment you might want to replace this with a more graceful response that won't break your consuming system.
One approach to dealing with this is to create a "catch all" request/response pair and have it return an appropriate response code and maybe a JSON error that your front end can deal with, for example a 400 and some JSON in the error format you use. To configure this set the matcher's HTTP Verb to ALL, and do not set any other matchers in that endpoint. Then this will match if none of the other matchers are successful in catching the request, and always return something that you control.