ServiceStack/ServiceStack — pull request #839 by Its-Tyson (2013-10-07 09:12:35+00:00)
Title: Custom HttpHandler configurations overwrite response status code.

If using custom http handlers to return custom pages for e.g. 404, 500 errors, the response status code gets overwritten to whatever the inner handler sets it to, usually a 200.

e.g:

SetConfig(new EndpointHostConfig {
CustomHttpHandlers = {
{ HttpStatusCode.NotFound, new RazorHandler("/notfound") }
}
});
http://razor.servicestack.net/#smart-views

You can see the live rockstars example here, while it looks like a 404 page, actually returns a 200 OK.
http://razor.servicestack.net/stars/alive/coldplay

This pull request is only a repro test so far. Not sure where to fix this one, it cant be done before passing to the inner handler as the inner handler will just overwrite it, and it can't be done after as the inner handlers can close the response stream.