question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ProxyAndRecord does not save query-parameters, headers and body

See original GitHub issue

When we try to record a request with HttpMethod as post, then we are getting error as below. Can someone please help me if I am missing anything.

I am starting server as below

string url = "http://localhost:1111/";
            var server = FluentMockServer.Start(new FluentMockServerSettings
            {
                Urls = new[] { url },
                StartAdminInterface = true,
                ReadStaticMappings=true,
                ProxyAndRecordSettings = new ProxyAndRecordSettings
                {
                    Url = "http://www.google.com/",
                    SaveMapping = true
                }
            });

Error is as below. But when I create a static mapping for the above serevr with Post as method then it works fine. Seeing the below issue only when we try to record it.

System.InvalidOperationException: Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects.
   at System.Net.Http.Headers.HttpHeaders.CheckHeaderName(String name)
   at System.Net.Http.Headers.HttpHeaders.Add(String name, IEnumerable`1 values)
   at WireMock.Http.HttpClientHelper.<SendAsync>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WireMock.Server.FluentMockServer.<ProxyAndRecordAsync>d__11.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at WireMock.Mapping.<ResponseToAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at WireMock.Owin.WireMockMiddleware.<Invoke>d__5.MoveNext()

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:25

github_iconTop GitHub Comments

1reaction
StefHcommented, Oct 26, 2017

Ah. Maybe I understand you problem:

When WireMock is in Proxy-mode (ProxyAndRecordSettings defined), it can only be used for that purpose.

The idea is that when you are done proying & recording, you must start and use WireMock in a normal way.

1reaction
StefHcommented, Oct 25, 2017

Ok. The latest code from yesterday should fix some issues with headers. However I am not sure I ever tested something else then GET… Will have to check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

query parameters cannot be retrieved from request header
getHeader is for retrieving HTTP headers. It is not the same thing as request parameter. So getParameter is method that retrieves query ......
Read more >
When is it appropriate to put information in request headers ...
So, I would choose to send it as a header. This is the same reason you do not put usernames & passwords as...
Read more >
HTTP headers and common query string parameters for ...
All headers used by the JSON API; The query parameters that apply to any JSON API request. See specific methods for additional query...
Read more >
Understanding REST Headers and Parameters
We'll discuss the basics of REST headers and parameters in this easy to understand article.
Read more >
REST API Headers vs Path Parameters vs Query ... - YouTube
A discussion on the purpose and proper usage of HTTP Headers, Path Parameters, Query Parameters and Request Body when developing a REST API ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found