3 ms·
All good points, but you missed the most important part: in any mature programming language, you're not implementing the HttpClient yourself: it's a library, pa
by paledot 6y ago
All good points, but you missed the most important part: in any mature programming language, you're not implementing the HttpClient yourself: it's a library, package, bundle, whatever. Which means that when you mock that you're not missing out on testing any code that you wrote, and the project that maintains your HttpClient (hopefully) has their own community-maintained test suite.
- berkes 6y agoHave a look at VCR. It was developed for Ruby, and does exactly that: mock out the actual HTTP part of your HTTPClient. It does this by first making the actual request and then storing that record in a plain YAML file (which you can alternatively generate yourself, by hand or from an openapi spec) Have a look at "Ports in Other Languages" in their README to find the VCR port for your language, framework or stack.