Skip to content

Commit f41306d

Browse files
committed
Override dict.copy in HTTPHeaders to return the correct type.
Closes tornadoweb#519.
1 parent e101397 commit f41306d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tornado/httputil.py

+4
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def update(self, *args, **kwargs):
154154
for k, v in dict(*args, **kwargs).iteritems():
155155
self[k] = v
156156

157+
def copy(self):
158+
# default implementation returns dict(self), not the subclass
159+
return HTTPHeaders(self)
160+
157161
_NORMALIZED_HEADER_RE = re.compile(r'^[A-Z0-9][a-z0-9]*(-[A-Z0-9][a-z0-9]*)*$')
158162
_normalized_headers = {}
159163

0 commit comments

Comments
 (0)