mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-07 10:40:09 +00:00
Copy as raw request
Issue #807 I am not entirely sure what needs to be returned in this case.
This commit is contained in:
parent
34ec2d1370
commit
152e395fa4
@ -282,6 +282,8 @@ def export_prompt(k, flow):
|
|||||||
copy_as_curl_command(flow)
|
copy_as_curl_command(flow)
|
||||||
elif k == "p":
|
elif k == "p":
|
||||||
copy_as_python_code(flow)
|
copy_as_python_code(flow)
|
||||||
|
elif k == "r":
|
||||||
|
copy_as_raw_request(flow)
|
||||||
|
|
||||||
|
|
||||||
def copy_as_curl_command(flow):
|
def copy_as_curl_command(flow):
|
||||||
@ -331,6 +333,16 @@ def copy_as_python_code(flow):
|
|||||||
copy_to_clipboard_or_prompt(data)
|
copy_to_clipboard_or_prompt(data)
|
||||||
|
|
||||||
|
|
||||||
|
def copy_as_raw_request(flow):
|
||||||
|
if flow.request.content is None or flow.request.content == CONTENT_MISSING:
|
||||||
|
signals.status_message.send(message="Request content is missing")
|
||||||
|
return
|
||||||
|
|
||||||
|
data = netlib.http.http1.assemble_request(flow.request)
|
||||||
|
|
||||||
|
copy_to_clipboard_or_prompt(data)
|
||||||
|
|
||||||
|
|
||||||
def copy_to_clipboard_or_prompt(data):
|
def copy_to_clipboard_or_prompt(data):
|
||||||
# pyperclip calls encode('utf-8') on data to be copied without checking.
|
# pyperclip calls encode('utf-8') on data to be copied without checking.
|
||||||
# if data are already encoded that way UnicodeDecodeError is thrown.
|
# if data are already encoded that way UnicodeDecodeError is thrown.
|
||||||
|
@ -262,6 +262,7 @@ class ConnectionItem(urwid.WidgetWrap):
|
|||||||
keys = (
|
keys = (
|
||||||
("as curl command", "c"),
|
("as curl command", "c"),
|
||||||
("as python code", "p"),
|
("as python code", "p"),
|
||||||
|
("as raw request", "r"),
|
||||||
),
|
),
|
||||||
callback = common.export_prompt,
|
callback = common.export_prompt,
|
||||||
args = (self.flow,)
|
args = (self.flow,)
|
||||||
|
@ -582,6 +582,7 @@ class FlowView(tabs.Tabs):
|
|||||||
keys = (
|
keys = (
|
||||||
("as curl command", "c"),
|
("as curl command", "c"),
|
||||||
("as python code", "p"),
|
("as python code", "p"),
|
||||||
|
("as raw request", "r"),
|
||||||
),
|
),
|
||||||
callback = common.export_prompt,
|
callback = common.export_prompt,
|
||||||
args = (self.flow,)
|
args = (self.flow,)
|
||||||
|
Loading…
Reference in New Issue
Block a user