mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-25 09:48:28 +02: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.
|
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/.*"))
|
```csharp
|
||||||
.willReturn(aResponse().proxiedFrom("http://otherhost.com/approot")));
|
server
|
||||||
|
.Given(
|
||||||
|
Request.Create().WithPath("/other/service")
|
||||||
|
)
|
||||||
|
.RespondWith(
|
||||||
|
Response.Create()
|
||||||
|
.ProxyFrom("http://otherhost.com/approot")
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
The JSON equivalent would be:
|
The JSON equivalent would be:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user