mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2025-02-08 11:10:21 +00:00
parent
06da673942
commit
66c50ae7a5
@ -5,6 +5,7 @@ from mitmproxy import ctx
|
||||
from mitmproxy import command
|
||||
from mitmproxy import exceptions
|
||||
from mitmproxy import flow
|
||||
from mitmproxy import http
|
||||
from mitmproxy import contentviews
|
||||
from mitmproxy.utils import strutils
|
||||
import mitmproxy.types
|
||||
@ -378,6 +379,12 @@ class ConsoleAddon:
|
||||
# but for now it is.
|
||||
if not flow:
|
||||
raise exceptions.CommandError("No flow selected.")
|
||||
require_dummy_response = (
|
||||
part in ("response-headers", "response-body", "set-cookies") and
|
||||
flow.response is None
|
||||
)
|
||||
if require_dummy_response:
|
||||
flow.response = http.HTTPResponse.make()
|
||||
if part == "cookies":
|
||||
self.master.switch_view("edit_focus_cookies")
|
||||
elif part == "form":
|
||||
@ -395,8 +402,6 @@ class ConsoleAddon:
|
||||
message = flow.request
|
||||
else:
|
||||
message = flow.response
|
||||
if not message:
|
||||
raise exceptions.CommandError("Flow has no {}.".format(part.split("-")[0]))
|
||||
c = self.master.spawn_editor(message.get_content(strict=False) or b"")
|
||||
# Fix an issue caused by some editors when editing a
|
||||
# request/response body. Many editors make it hard to save a
|
||||
|
Loading…
Reference in New Issue
Block a user