aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/console/common.py')
-rw-r--r--libmproxy/console/common.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py
index 2ea77449..db40201f 100644
--- a/libmproxy/console/common.py
+++ b/libmproxy/console/common.py
@@ -282,6 +282,8 @@ def export_prompt(k, flow):
copy_as_curl_command(flow)
elif k == "p":
copy_as_python_code(flow)
+ elif k == "r":
+ copy_as_raw_request(flow)
def copy_as_curl_command(flow):
@@ -331,6 +333,16 @@ def copy_as_python_code(flow):
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):
# pyperclip calls encode('utf-8') on data to be copied without checking.
# if data are already encoded that way UnicodeDecodeError is thrown.