Add X-Jwt-Payload to redacted headers

This commit is contained in:
allegroai 2022-05-17 15:55:41 +03:00
parent 69737308fe
commit 3efed32934

View File

@ -313,6 +313,7 @@ class APICall(DataContainer):
_redacted_headers = {
HEADER_AUTHORIZATION: " ",
"Cookie": "=",
"X-Jwt-Payload": "",
}
""" Headers whose value should be redacted. Maps header name to partition char """
@ -692,6 +693,10 @@ class APICall(DataContainer):
# this will allow us to debug authorization errors).
for header, sep in self._redacted_headers.items():
if header in headers:
prefix, _, redact = headers[header].partition(sep)
if sep:
prefix, _, redact = headers[header].partition(sep)
else:
prefix = sep = ""
redact = headers[header]
headers[header] = prefix + sep + f"<{len(redact)} bytes redacted>"
return headers