How do I return HTTP error code without default template in Tornado?
python, tornado
Solution
You may simulate `RequestHandler.send_error` method:
class MyHandler(tornado.web.RequestHandler):
def get(self):
self.clear()
self.set_status(400)
self.finish("<html><body>My custom body</body></html>")
Problem
I am currently using the following to raise a HTTP bad request: ``` raise tornado.web.HTTPError(400) ``` which returns a html output: ``` <html><title>400: Bad Request</title><body>400: Bad Request</body></html> ``` Is it possible to return just the HTTP response code with a custom body?