pythonhttptornadorequesthandlerhttp-head

tornado requesthandler overwrite head method


I'm using tornado framework of python to build up my site, and I encountered a problem. Now there is a requirement my site should response to head method, but in tornado, it would only return a 405 response, while I need to return the header of the request, so how to implement the head method of tornado's requesthandler?


Solution

  • I had to do this recently to keep Mandril happy.

    It turns out to be simple - create a head(self) function in your Handler:

    class InboundEmailHandler(base.BaseHandler):
    
        def head(self):
            """ Satisfy Mandril that this url exists"""
            self.finish()