[PR #60] [MERGED] Fix proxy headers handling #750

Closed
opened 2025-12-29 08:33:24 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/wiremock/WireMock.Net/pull/60
Author: @Dreamescaper
Created: 10/28/2017
Status: Merged
Merged: 10/28/2017
Merged by: @StefH

Base: masterHead: proxy_fixes


📝 Commits (2)

  • cbd5b2f Fix proxy headers handling
  • 9789b98 Small refactor and moved proxy tests to new test-file.

📊 Changes

9 files changed (+245 additions, -131 deletions)

View changed files

📝 WireMock.Net Solution.sln (+4 -1)
📝 examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Record.NETCoreApp.csproj (+4 -0)
examples/WireMock.Net.Console.Record.NETCoreApp/__admin/mappings/791a3f31-6946-4ce7-8e6f-0237c7443275.json (+0 -36)
examples/WireMock.Net.Console.Record.NETCoreApp/__admin/mappings/ab38efae-4e4d-4f20-8afe-635533ec2535.json (+0 -41)
📝 src/WireMock.Net/Http/HttpClientHelper.cs (+56 -20)
📝 src/WireMock.Net/ResponseBuilders/Response.cs (+6 -2)
📝 src/WireMock.Net/Server/FluentMockServer.Admin.cs (+5 -1)
test/WireMock.Net.Tests/FluentMockServerTests.Proxy.cs (+157 -0)
📝 test/WireMock.Net.Tests/FluentMockServerTests.cs (+13 -30)

📄 Description

Fix following issues with proxy (and tests added):

  • content headers were not set in both request and response
  • cookies were not set in request
  • auto-redirect should not be performed when proxying requests
  • if redirect response happened, and absolute Location host is the one that we're proxying to, we should change it to called one
  • creating new HttpClient for each request in not the best idea. I changed it so it would be created only once per ResponseBuilder.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/wiremock/WireMock.Net/pull/60 **Author:** [@Dreamescaper](https://github.com/Dreamescaper) **Created:** 10/28/2017 **Status:** ✅ Merged **Merged:** 10/28/2017 **Merged by:** [@StefH](https://github.com/StefH) **Base:** `master` ← **Head:** `proxy_fixes` --- ### 📝 Commits (2) - [`cbd5b2f`](https://github.com/wiremock/WireMock.Net/commit/cbd5b2f5bd9f4236c0088ecf04c99c9feb192811) Fix proxy headers handling - [`9789b98`](https://github.com/wiremock/WireMock.Net/commit/9789b98304ddb7b51d4ecf2e47a6400c14418ebf) Small refactor and moved proxy tests to new test-file. ### 📊 Changes **9 files changed** (+245 additions, -131 deletions) <details> <summary>View changed files</summary> 📝 `WireMock.Net Solution.sln` (+4 -1) 📝 `examples/WireMock.Net.Console.Record.NETCoreApp/WireMock.Net.Console.Record.NETCoreApp.csproj` (+4 -0) ➖ `examples/WireMock.Net.Console.Record.NETCoreApp/__admin/mappings/791a3f31-6946-4ce7-8e6f-0237c7443275.json` (+0 -36) ➖ `examples/WireMock.Net.Console.Record.NETCoreApp/__admin/mappings/ab38efae-4e4d-4f20-8afe-635533ec2535.json` (+0 -41) 📝 `src/WireMock.Net/Http/HttpClientHelper.cs` (+56 -20) 📝 `src/WireMock.Net/ResponseBuilders/Response.cs` (+6 -2) 📝 `src/WireMock.Net/Server/FluentMockServer.Admin.cs` (+5 -1) ➕ `test/WireMock.Net.Tests/FluentMockServerTests.Proxy.cs` (+157 -0) 📝 `test/WireMock.Net.Tests/FluentMockServerTests.cs` (+13 -30) </details> ### 📄 Description Fix following issues with proxy (and tests added): - content headers were not set in both request and response - cookies were not set in request - auto-redirect should not be performed when proxying requests - if redirect response happened, and absolute Location host is the one that we're proxying to, we should change it to called one - creating new HttpClient for each request in not the best idea. I changed it so it would be created only once per ResponseBuilder. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 08:33:24 +01:00
adam closed this issue 2025-12-29 08:33:24 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net#750