Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gregoks opened this issue Aug 29, 2019 · 8 comments
Closed

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

gregoks opened this issue Aug 29, 2019 · 8 comments
Assignees
Labels

Comments

@gregoks
Copy link

gregoks commented Aug 29, 2019

Hi,

I'm having an issue when using proxy, the content-type header disappears.
Though I saw that this issue was resolved - (#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

@StefH
Copy link
Collaborator

StefH commented 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.

@gregoks
Copy link
Author

gregoks commented 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

@StefH
Copy link
Collaborator

StefH commented Aug 30, 2019

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

@StefH
Copy link
Collaborator

StefH commented Aug 30, 2019

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

@gregoks
Copy link
Author

gregoks commented Aug 31, 2019

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

@StefH
Copy link
Collaborator

StefH commented Aug 31, 2019

I think it works as expected:
image

@StefH StefH added the bug label Aug 31, 2019
@StefH StefH self-assigned this Aug 31, 2019
@gregoks
Copy link
Author

gregoks commented Aug 31, 2019

yep just tested it. thanks a lot!

@StefH StefH closed this as completed Sep 1, 2019
@StefH
Copy link
Collaborator

StefH commented Sep 1, 2019

New NuGet is uploaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants