WireMock-Net / WireMock.Net

WireMock.Net is a flexible product for stubbing and mocking web HTTP responses using advanced request matching and response templating. Based on the functionality from http://WireMock.org, but extended with more functionality.
Apache License 2.0
1.42k stars 209 forks source link

Getting all currently registered stub mappings #12

Closed StefH closed 7 years ago

gregoks commented 5 years ago

Hi,

I was wondering if this is implemented? Because I see now that RequestMatchers in RequestMessageCompositeMatcher class is private. So is there a way we can get the instance of all registered mappings like we see them in the admin API?

Thx,

Greg

StefH commented 5 years ago

Hello Greg; you can just access Mappings ?

Like https://github.com/WireMock-Net/WireMock.Net/blob/12444cc11e0c806a2436e2a823227dc757781b29/test/WireMock.Net.Tests/FluentMockServerTests.Settings.cs#L102

gregoks commented 5 years ago

Yeah but its an interface of IMapping, I want to be able to serialize it and send it as an object over http. Thats why I need the mapping info like path, request matchers, response etc as properties.

StefH commented 5 years ago

You know you can just do a GET request to the /__admin/mappings to get all mappings?

gregoks commented 5 years ago

Yeah I know but since I have the server object in memory, I was wondering if I could get the mappings the same way as I can get LogEntries without the need of extra http call

StefH commented 5 years ago

I see, can you create a new issue?

StefH commented 5 years ago

https://github.com/WireMock-Net/WireMock.Net/pull/298

gregoks commented 5 years ago

Thanks @StefH for the quick response! Not sure if you still need it but I have created a new issue: https://github.com/WireMock-Net/WireMock.Net/issues/299