mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Question: proxy passthrough when no match? #153
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ArtemTrofimushkin on GitHub (Nov 7, 2018).
Hi everyone.
I am using this library for my integration tests and have some issues with it.
Let me explain my setup and scenario.
Setup:
Scenario: Cover frontend service with integration tests.
Implementation:
Integration tests, frontend and library (WireMock.Net-docker) running in a docker. I want the following: setup proxy to backend for all endpoints by default, except that I want to mock with special json stub and try to test logic in my fontend service.
For configuration of mocking/proxy I've created simple utility lib, that uses Admin REST API of WireMock.NET library. But, configured proxy doesn't response for any requests when I run tests. When I tried to figure out what happened with the proxy, I cloned repository and ran it locally.
After some debugging and researching already closed issues, I saw the following lines of the code (OwinResponseMapper.MapAsync):
When I tried to change the target of the solution to the .NET Core 2.1 only and convert code to following:
It started to work as I expected. Something similar was in already closed issue (https://github.com/WireMock-Net/WireMock.Net/issues/148).
After some researching, I found that my backend server was responding with following HTTP header: Transfer-Encoding chunked. This header was excluded by this method: WebHeaderCollection.IsRestricted in .NET Core 2.1. It seems that this library needs some fixes for such HTTP headers.
@s-krawczyk commented on GitHub (Nov 7, 2018):
Got same issue moment ago. Funny ;) What I can do on my side. How to "hack" this?
@StefH commented on GitHub (Nov 7, 2018):
I've modified the code so that I manually check all restricted response headers as defined here:
https://docs.microsoft.com/en-us/dotnet/api/system.net.webheadercollection.isrestricted?view=netframework-4.7.2
See the branch:
https://github.com/WireMock-Net/WireMock.Net/tree/restricted_headers
Can you test if this works for both net4x and netstandard 2.0 / netcore app 2,1 ?
@StefH commented on GitHub (Nov 7, 2018):
Or you can test version
1.0.4.19-ci-1475from MyGet@ArtemTrofimushkin commented on GitHub (Nov 7, 2018):
Yep, this version works for my .NET Core 2.1 project
@StefH commented on GitHub (Nov 7, 2018):
https://github.com/WireMock-Net/WireMock.Net/pull/228
@StefH commented on GitHub (Nov 7, 2018):
Closing