Mocking an HTTP call with a fixed URL
At work I ran into the need to mock an HTTP call to a fixed address.
The code being tested verifies that the URL being called is legitimate and follows a certain set of rules. Therefore it was impossible to use the address of a local server (at least not directly).
To write tests for my code, I needed to write something that mocked the return values of a valid endpoint without actually making a call to the original, validated address.
[Read More]