Respond with both body and status code in Nancy

前端 未结 4 1700
花落未央
花落未央 2020-12-29 20:23

I\'m new to Nancy and I want to return both a custom HttpStatusCode and a body (content). If I return an HttpStatusCode, it returns it with a blank body. If I return a str

4条回答
  •  北海茫月
    2020-12-29 21:20

    This is the simplest way I've found:

    Return from your Module:

    return new Response {
                    StatusCode = HttpStatusCode.NotFound, ReasonPhrase = "Resource not found"
                };
    

提交回复
热议问题