MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / httpie_command

Function httpie_command

mitmproxy/addons/export.py:103–118  ·  view source on GitHub ↗
(f: flow.Flow)

Source from the content-addressed store, hash-verified

101
102
103def httpie_command(f: flow.Flow) -> str:
104 request = cleanup_request(f)
105 pop_headers(request)
106
107 # TODO: Once https://github.com/httpie/httpie/issues/414 is implemented, we
108 # should ensure we always connect to the IP address specified in the flow,
109 # similar to how it's done in curl_command.
110 url = request.pretty_url
111
112 args = ["http", request.method, url]
113 for k, v in request.headers.items(multi=True):
114 args.append(f"{k}: {v}")
115 cmd = " ".join(shlex.quote(arg) for arg in args)
116 if request.content:
117 cmd += " <<< " + request_content_for_console(request)
118 return cmd
119
120
121def raw_request(f: flow.Flow) -> bytes:

Callers

nothing calls this directly

Calls 6

cleanup_requestFunction · 0.85
pop_headersFunction · 0.85
itemsMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…