fix util.dump_response to work with bytes as header values

pull/4906/head
Mike Fährmann 10 months ago
parent 6a4218aa23
commit bdebe4597a
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -275,7 +275,7 @@ Response Headers
if hide_auth:
authorization = req_headers.get("Authorization")
if authorization:
atype, sep, _ = authorization.partition(" ")
atype, sep, _ = str(authorization).partition(" ")
req_headers["Authorization"] = atype + " ***" if sep else "***"
cookie = req_headers.get("Cookie")
@ -291,15 +291,17 @@ Response Headers
r"(^|, )([^ =]+)=[^,;]*", r"\1\2=***", set_cookie,
)
fmt_nv = "{}: {}".format
fp.write(outfmt.format(
request=request,
response=response,
request_headers="\n".join(
name + ": " + value
fmt_nv(name, value)
for name, value in req_headers.items()
),
response_headers="\n".join(
name + ": " + value
fmt_nv(name, value)
for name, value in res_headers.items()
),
).encode())

Loading…
Cancel
Save