Emit HTTP status code inside handler methods

Also remove bogus HTTP 500 internal errors which were sent after the
response body.