Hi,
I've recently started using WireMock and it seems I get a strange behavior when trying something like:
wireMockServer.addStubMapping(get(urlEqualTo("/admin/agent/registered"))
.withHeader("apikey", equalTo(""))
.willReturn(aResponse()
.withStatus(200)
.withBody("[\n" +
" {\n" +
...
" }\n" +
"]")).build());I am using WebClient (C#) to make the actual HTTP request which allows me to do the following:
webClient.Headers.Add("apikey", "");
This means that sometimes my value is an empty string.
I can observe the following behavior:
- If I don't specify "withHeader" I will get a 404 from Jetty when value is empty string
- If I specify it I will get a 500 from Jetty (using Postman I can see some more details:
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /admin/agent/registered. Reason:
<pre> java.lang.IllegalStateException: No value for apikey</pre>
</p>
<hr />
<i>
<small>Powered by Jetty://</small>
</i>
</body>
Please let me know if I'm missing something. Or if I can provide more info.
Alin