How do you test code that integrates with a third party HTTP service? The Philosophical Answer If you think about it, it is not an easy question to answer. Maybe you have already some strong opinions formed about it. But, in my experience, answers to this question differ greatly among developers, even between seasoned ones. I believe those differences are due to some preconceived ideas or different definitions about what testing is.
The HTTP protocol, the REST architectural pattern and API design are amongst my favorite topics in software development. I closely follow the latest RFCs, technologies and standards built over these, and over the years I’ve learned how not to repeat the mistakes of the past by improving the way I used to to things. Count functionality implemented in a poor way is one of those mistakes. Back in the day I would have my api resources implement a count endpoint like this: GET /some-resource/count.