WireMock.Net
WireMock.Net copied to clipboard
Encoded url path parameter decoded via proxy
Describe the bug
An encoded url parameter looks decoded by WireMock server. My code sends a request like : POST http://localhost:4200/api/file%3Atest.pdf to Wiremock proxy server. The url is then transformed to POST https://webservie.com/api/file:test.pdf. Here the url encoded parameter file%3Atest.pdf is decoded and forwarded as file:test.pdf which generate an error from the webservice
I
Expected behavior:
I expect that encoded url parameter are not decoded
Test to reproduce
- Create a mock server with proxy (here is my code)
MockServer = WireMockServer.Start(new WireMockServerSettings
{
Urls = [BaseProxyURL],
FileSystemHandler = new LocalFileSystemHandler(recordingPath),
});
MockServer
.Given(Request.Create().WithPath($"*/service/*"))
.RespondWith(Response.Create()
.WithProxy(new ProxyAndRecordSettings
{
Url = "https://webservice.com/",
SaveMapping = true,
SaveMappingToFile = true,
ExcludedHeaders = ["Authorization"],
ReplaceSettings = new ProxyUrlReplaceSettings
{
OldValue = $"/service",
NewValue = ""
}
})
);
- Capture the outbound traffic with fiddler
- Send a request containing an encoded url parameter