Search code examples
c#wiremockwiremock-standalone

Wiremock admin stub issue


I have a stub file that i'm sending via the c# admin api to a standalone wiremock instance. I'm getting the expected response back when i send via postman except the response body is always empty, even though in my file i have this:

"Response": {
"Delay": 500,
"UseTransformer": true,
"StatusCode": 205,
"BodyAsJson": { "result": "PRIO = 1 . test" },
"Headers": {
  "Content-Type": "application/json",
  "a": "b"
}

}

I see the expected header a b but nothing in the body. Also if i change it to be plain text:

"Response": {
"Delay": 500,
"UseTransformer": true,
"StatusCode": 205,
"body": "Hello world!",
"Headers": {
  "Content-Type": "application/text",
  "a": "b"
}

This doesn't work either - what am i doing wrong ?


Solution

  • Could it be that HTTP 205 does not allow you to return a body? So can you try HTTP 200 ?

    See also https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

    10.2.6 205 Reset Content

    The server has fulfilled the request and the user agent SHOULD reset the document view which caused the request to be sent. This response is primarily intended to allow input for actions to take place via user input, followed by a clearing of the form in which the input is given so that the user can easily initiate another input action. The response MUST NOT include an entity.