MCPcopy
hub / github.com/urllib3/urllib3 / render_headers

Method render_headers

src/urllib3/fields.py:291–308  ·  view source on GitHub ↗

Renders the headers for this request field.

(self)

Source from the content-addressed store, hash-verified

289 return "; ".join(parts)
290
291 def render_headers(self) -> str:
292 """
293 Renders the headers for this request field.
294 """
295 lines = []
296
297 sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"]
298 for sort_key in sort_keys:
299 if self.headers.get(sort_key, False):
300 lines.append(f"{sort_key}: {self.headers[sort_key]}")
301
302 for header_name, header_value in self.headers.items():
303 if header_name not in sort_keys:
304 if header_value:
305 lines.append(f"{header_name}: {header_value}")
306
307 lines.append("\r\n")
308 return "\r\n".join(lines)
309
310 def make_multipart(
311 self,

Callers 4

test_createMethod · 0.95
test_make_multipartMethod · 0.95

Calls 2

getMethod · 0.80
itemsMethod · 0.80

Tested by 3

test_createMethod · 0.76
test_make_multipartMethod · 0.76