azagniotov/stubby4j

Feature suggestion: GET /history

Closed this issue · 1 comments

Hi all,
I've been using stubby4j for a while, especially the docker image for my integration tests with docker-compose, and it's amazing!
However, recently I came across this scenario: I want to be able to test a 'side effect' of my service. That means, I have a service that returns a value, but also performs something like writing some data asynchronously to a database or something.
So basically, my server's request handler looks something like this:

handler (req, res) {
    saveHeaders(req); // This launches an async HTTP call!
    res.send(200)
}

And let's assume 'saveHeaders' calls a service called 'headersRepository', and I want to stub this repository for my tests.
The problem I have is that I need a way to make sure in my tests that 'headersRepository' stub server was indeed called and that the call was accepted (i.e. that it returned 200 or anything like that).

I think it can be useful to add a default endpoint to every stubby image that returns the history of requests and responses, and it will provide a solution to the described problem.
What do think? Is this something worth start working on?

It is not a bad idea, but honestly I do not think i will get to this any time soon.