https://github.com/findinpath/wiremock-recorded-request-timestamp
Proof of concept for recording the timestamp of requests made towards WireMock server
https://github.com/findinpath/wiremock-recorded-request-timestamp
wiremock
Last synced: about 1 year ago
JSON representation
Proof of concept for recording the timestamp of requests made towards WireMock server
- Host: GitHub
- URL: https://github.com/findinpath/wiremock-recorded-request-timestamp
- Owner: findinpath
- Created: 2019-11-13T11:56:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-11-13T14:50:53.000Z (over 6 years ago)
- Last Synced: 2025-01-29T18:32:03.298Z (over 1 year ago)
- Topics: wiremock
- Language: Java
- Homepage: https://www.findinpath.com/wiremock-logged-requests/
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Record the timestamp of requests made towards WireMock server
=============================================================
This project is a proof of concept for showing how to log the timestamp of the requests
made toward the [WireMock](http://wiremock.org/) server.
WireMock records by default information about which requests are made to the mock
server and also when these requests were made.
Such a functionality can come in handy in tests where it is needed to make sure that a certain
API call happens only after another event (e.g. : the API call made to insert the corresponding
entry in the search index engine - Apache Solr, elasticearch - is done only after the entry has
been saved in the relational database - otherwise the search engine could return inaccurate data
in case of database failure).
Consult [Wiremock Verifying](http://wiremock.org/docs/verifying/) section for more details on
the available operations for retrieving the details about the requests performed towards WireMock.
WireMock also provides a series of instruments that can be used to extend its basic functionality:
- `com.github.tomakehurst.wiremock.extension.requestfilter.RequestFilter`
- `com.github.tomakehurst.wiremock.extension.PostServeAction`
- `com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer`
When registering an extension based on these classes in WireMock, there could be accessed
the requests made towards WireMock and specific callbacks could be registered depending on the
needs in the tests.
Out of the classes enumerated earlier, the interface `com.github.tomakehurst.wiremock.extension.requestfilter.RequestFilter`
is the most appropriate for recording the exact timestamp when a request has been made because it doesn't
take into consideration the eventual delays configured for the stub endpoint on WireMock.