I found the simple solution was to override the OnAfterExecute
method in my custom ServiceStack ServiceRunner
.
If there is no response (because the method returned void
) and the ContentType
is application/json
then send an empty object.
public override object OnAfterExecute(IRequestContext requestContext, object response)
{
if(response == null && requestContext.ContentType == "application/json")
response = new {};
return base.OnAfterExecute(requestContext, response);
}