mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-05-27 10:19:15 +02:00
Updated Proxying (markdown)
+27
-1
@@ -1,3 +1,30 @@
|
|||||||
|
# Global Proxy
|
||||||
|
It's possible to start the WireMockk server in Proxy mode, this means that all requests are proxied to the real URL. And the mappings can be recorded and saved.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
Setup a proxy to samples.openweathermap.org
|
||||||
|
|
||||||
|
``` c#
|
||||||
|
var settings = new FluentMockServerSettings
|
||||||
|
{
|
||||||
|
Urls = new[] { "https://localhost:9095/" },
|
||||||
|
StartAdminInterface = true,
|
||||||
|
ProxyAndRecordSettings = new ProxyAndRecordSettings
|
||||||
|
{
|
||||||
|
Url = "https://samples.openweathermap.org",
|
||||||
|
SaveMapping = true,
|
||||||
|
SaveMappingToFile = true,
|
||||||
|
SaveMappingForStatusCodePattern = "2xx"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var server = FluentMockServer.Start(settings);
|
||||||
|
```
|
||||||
|
|
||||||
|
You can now call (via an httpclient or just in browser) this URL: `https://localhost:9095/data/2.5/find?q=London&units=metric&appid=b6907d289e10d714a6e88b30761fae22`
|
||||||
|
|
||||||
|
See also this [proxyandrecordsettings](https://github.com/WireMock-Net/WireMock.Net/wiki/Settings#proxyandrecordsettings)
|
||||||
|
|
||||||
# Proxy stub mappings
|
# Proxy stub mappings
|
||||||
Proxy responses are defined in exactly the same manner as stubs, meaning that the same request matching criteria can be used.
|
Proxy responses are defined in exactly the same manner as stubs, meaning that the same request matching criteria can be used.
|
||||||
|
|
||||||
@@ -69,4 +96,3 @@ server
|
|||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user