Captures HTTP request/responses interactions in any server, which supports http.Handler and standard middleware. One of the use cases is to generate Pact files
to verify, via contract testing (swagger-mock-validator), that mocks are consistent with real provider.
go 1.9 or higher
Get the httptest-interaction-listener as a dependency
go get bitbucket.org/atlassian/httptest-interaction-listener
HTTP Interaction Recorder provides a stdlib net/http middleware handler to record http interactions, which makes it compatible with any standard middleware in the community.
Recording or any postprocessing of an interaction takes place in listeners, which are supplied to a middleware and called after response was sent to client.
Listeners must implement RequestReceived(request recorder.Request, response recorder.Response) method.
In this example a “consumer” service mocks out response from a “provider” service using a stdlib httptest.NewServer. Pact listener will
record every interaction with httptest.NewServer and save it in the ./pacts folder next to the test file.