MCPcopy Create free account
hub / github.com/mitmproxy/mitmproxy / pop_headers

Function pop_headers

mitmproxy/addons/export.py:27–34  ·  view source on GitHub ↗

Remove some headers that are redundant for curl/httpie export.

(request: http.Request)

Source from the content-addressed store, hash-verified

25
26
27def pop_headers(request: http.Request) -> None:
28 """Remove some headers that are redundant for curl/httpie export."""
29 request.headers.pop("content-length", None)
30
31 if request.headers.get("host", "") == request.host:
32 request.headers.pop("host")
33 if request.headers.get(":authority", "") == request.host:
34 request.headers.pop(":authority")
35
36
37def cleanup_response(f: flow.Flow) -> http.Response:

Callers 2

curl_commandFunction · 0.85
httpie_commandFunction · 0.85

Calls 2

popMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…