Proxy Missing header Content-Type - tried with Recording #209

Closed
opened 2025-12-29 14:25:10 +01:00 by adam · 8 comments
Owner

Originally created by @gregoks on GitHub (Aug 29, 2019).

Originally assigned to: @StefH on GitHub.

Hi,

I'm having an issue when using proxy, the content-type header disappears.
Though I saw that this issue was resolved - (https://github.com/WireMock-Net/WireMock.Net/issues/210)

But it still doesnt work for me.
I'm trying to send a request with "Content-Type" header with the following value:

application/soap+xml;charset=UTF-8;action="http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration"

with a proxy and I dont see the header in the proxy url. I have tried to use the proxy with record settings like you suggested in the original bug:

fluentMockServer.Given(requestMatcher)
                      .AtPriority(int.MaxValue)
                      .RespondWith(Response.Create()
                          .WithProxy(new ProxyAndRecordSettings{Url = "www.someProxyUrl.com" }));

but where do I see the recorded mappings?
From your code I dont understand how you use the ProxyAndRecordSettings in proxy because this method only uses the url part of the settings and not the recording options? ('Response' class):

public IResponseBuilder WithProxy(IProxyAndRecordSettings settings)
    {
      Check.NotNull<IProxyAndRecordSettings>(settings, nameof (settings));
      return this.WithProxy(settings.Url, settings.ClientX509Certificate2ThumbprintOrSubjectName);
    }

Can you please advise on:

  1. Check if content-type header proxies correctly with the entire original value.
  2. Where to see the recorded mappings using proxy?

Thanks!

Greg

Originally created by @gregoks on GitHub (Aug 29, 2019). Originally assigned to: @StefH on GitHub. Hi, I'm having an issue when using proxy, the content-type header disappears. Though I saw that this issue was resolved - (https://github.com/WireMock-Net/WireMock.Net/issues/210) But it still doesnt work for me. I'm trying to send a request with "Content-Type" header with the following value: `application/soap+xml;charset=UTF-8;action="http://myCompany.Customer.Contract/ICustomerService/GetSomeConfiguration" ` with a proxy and I dont see the header in the proxy url. I have tried to use the proxy with record settings like you suggested in the original bug: ``` fluentMockServer.Given(requestMatcher) .AtPriority(int.MaxValue) .RespondWith(Response.Create() .WithProxy(new ProxyAndRecordSettings{Url = "www.someProxyUrl.com" })); ``` but where do I see the recorded mappings? From your code I dont understand how you use the ProxyAndRecordSettings in proxy because this method only uses the url part of the settings and not the recording options? ('Response' class): ``` public IResponseBuilder WithProxy(IProxyAndRecordSettings settings) { Check.NotNull<IProxyAndRecordSettings>(settings, nameof (settings)); return this.WithProxy(settings.Url, settings.ClientX509Certificate2ThumbprintOrSubjectName); } ``` Can you please advise on: 1. Check if content-type header proxies correctly with the entire original value. 2. Where to see the recorded mappings using proxy? Thanks! Greg
adam added the bug label 2025-12-29 14:25:10 +01:00
adam closed this issue 2025-12-29 14:25:10 +01:00
Author
Owner

@StefH commented on GitHub (Aug 29, 2019):

See the example project WireMock.Net.Console.NETCoreApp2, with maping:

server
                .Given(Request.Create()
                    .UsingGet()
                    .WithPath("/proxy-test-keep-alive")
                )
                .RespondWith(Response.Create()
                    .WithHeader("Keep-Alive", "timeout=1, max=1")
                );

When posting a message like this:
image

You see that all headers are correctly sent and returned by by postman echo service.

@StefH commented on GitHub (Aug 29, 2019): See the example project `WireMock.Net.Console.NETCoreApp2`, with maping: ``` c# server .Given(Request.Create() .UsingGet() .WithPath("/proxy-test-keep-alive") ) .RespondWith(Response.Create() .WithHeader("Keep-Alive", "timeout=1, max=1") ); ``` When posting a message like this: ![image](https://user-images.githubusercontent.com/249938/63975724-f29d6680-caaf-11e9-9421-81bfe1f14aac.png) You see that all headers are correctly sent and returned by by postman echo service.
Author
Owner

@gregoks commented on GitHub (Aug 30, 2019):

Hi @StefH,

Ive made similar test to what you showed me and it looks like the "action" part of the Content-Type header isnt being sent, so the test that I've made is:

image

@gregoks commented on GitHub (Aug 30, 2019): Hi @StefH, Ive made similar test to what you showed me and it looks like the "action" part of the Content-Type header isnt being sent, so the test that I've made is: ![image](https://user-images.githubusercontent.com/15245808/64044603-e2e55700-cb6f-11e9-9df0-fb4ba959160c.png)
Author
Owner

@StefH commented on GitHub (Aug 30, 2019):

I see. This is a bug. I'll check the code.

@StefH commented on GitHub (Aug 30, 2019): I see. This is a bug. I'll check the code.
Author
Owner

@StefH commented on GitHub (Aug 30, 2019):

You can try version WireMock.Net.1.0.30-ci-11848 from MyGet

@StefH commented on GitHub (Aug 30, 2019): You can try version WireMock.Net.1.0.30-ci-11848 from MyGet
Author
Owner

@gregoks commented on GitHub (Aug 31, 2019):

Thanks for the quick fix as usual!
Ill give it a go and let you know :)

@gregoks commented on GitHub (Aug 31, 2019): Thanks for the quick fix as usual! Ill give it a go and let you know :)
Author
Owner

@StefH commented on GitHub (Aug 31, 2019):

I think it works as expected:
image

@StefH commented on GitHub (Aug 31, 2019): I think it works as expected: ![image](https://user-images.githubusercontent.com/249938/64060228-f02f2f80-cbc9-11e9-9c50-5b2471da8442.png)
Author
Owner

@gregoks commented on GitHub (Aug 31, 2019):

yep just tested it. thanks a lot!

@gregoks commented on GitHub (Aug 31, 2019): yep just tested it. thanks a lot!
Author
Owner

@StefH commented on GitHub (Sep 1, 2019):

New NuGet is uploaded

@StefH commented on GitHub (Sep 1, 2019): New NuGet is uploaded
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#209