ProxyAndRecord does not save query-parameters, headers and body
See original GitHub issueWhen 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:
- Created 6 years ago
- Comments:25
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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