mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-24 10:01:00 +01:00
Updated Proxying (markdown)
12
Proxying.md
12
Proxying.md
@@ -8,8 +8,16 @@ Proxy responses are defined in exactly the same manner as stubs, meaning that th
|
||||
|
||||
The following code will proxy all GET requests made to http://<host>:<port>/other/service/.* to http://otherservice.com/approot, e.g. when running WireMock.NET locally a request to http://localhost:9000/other/service/doc/123 would be forwarded to http://otherservice.com/approot/other/service/doc/123.
|
||||
|
||||
stubFor(get(urlMatching("/other/service/.*"))
|
||||
.willReturn(aResponse().proxiedFrom("http://otherhost.com/approot")));
|
||||
```csharp
|
||||
server
|
||||
.Given(
|
||||
Request.Create().WithPath("/other/service")
|
||||
)
|
||||
.RespondWith(
|
||||
Response.Create()
|
||||
.ProxyFrom("http://otherhost.com/approot")
|
||||
);
|
||||
```
|
||||
|
||||
The JSON equivalent would be:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user