tornado icon indicating copy to clipboard operation
tornado copied to clipboard

Expose web.RequestHandler._reason

Open dave-shawley opened this issue 2 years ago • 1 comments

Why? this is handy to have when you are writing custom access loggers and other "on finish" behaviors. I currently rely on handler._reason which is an internal. It also mirrors web.RequestHandler.get_status.

dave-shawley avatar Mar 17 '22 13:03 dave-shawley

I'm hesitant to add anything new related to the reason string because it's been removed in HTTP/2. It's nearly equivalent to do http.client.responses[handler.get_status()]. The only time it's not equivalent is if you're using a custom reason string, and if you want to use that in logging I think it's better to use a custom field to do it instead of piggybacking on a formerly-standard field that should go away one day.

bdarnell avatar Mar 18 '22 19:03 bdarnell