mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Logging tidy-up, IDE inspection fixes
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import tornado
|
||||
from tornado.httpclient import AsyncHTTPClient
|
||||
from tornado.httputil import HTTPHeaders
|
||||
|
||||
|
||||
class V1RedirectHandler(tornado.web.RequestHandler):
|
||||
"""Transparently proxies requests from the old API to the new one,
|
||||
@@ -30,13 +32,14 @@ class V1RedirectHandler(tornado.web.RequestHandler):
|
||||
raise tornado.web.HTTPError(502, reason=str(e))
|
||||
|
||||
self.set_status(response.code, response.reason)
|
||||
for name, value in response.headers.get_all():
|
||||
# Let Tornado recompute these for the outgoing response
|
||||
if name.lower() not in ("content-length", "transfer-encoding", "connection"):
|
||||
self.add_header(name, value)
|
||||
if response.body:
|
||||
self.write(response.body)
|
||||
self.finish()
|
||||
if isinstance(response.headers, HTTPHeaders):
|
||||
for name, value in response.headers.get_all():
|
||||
# Let Tornado recompute these for the outgoing response
|
||||
if name.lower() not in ("content-length", "transfer-encoding", "connection"):
|
||||
self.add_header(name, value)
|
||||
if response.body:
|
||||
self.write(response.body)
|
||||
await self.finish()
|
||||
|
||||
async def get(self, path):
|
||||
await self._proxy(path)
|
||||
|
||||
Reference in New Issue
Block a user