ServiceStack services are great for responding with the content type that's requested in the Accept
header. But if I need to close/end the response early from within a request filter, is there a way to respond with the proper content type? All I have access to in a request filter is the raw IHttpResponse so it seems to me that the only option is to tediously, manually check the Accept
header and do a bunch of switch/case statements to figure out which serializer to use and then write directly to the response.OutputStream
.
To further illustrate the question, in a normal service method you can do something like this:
public object Get(FooRequest request)
{
return new FooResponseObject()
{
Prop1 = "oh hai!"
}
}
And ServiceStack will figure out what content type to use and which serializer to use. Is there anything similar to this that I can do within a request filter?