Merge pull request #2858 from kajojify/revert_flow

Fix reverting of a flow
This commit is contained in:
Maximilian Hils 2018-02-13 20:08:35 +01:00 committed by GitHub
commit b689f48f7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,7 @@ class Core:
for f in flows: for f in flows:
p = getattr(f, part, None) p = getattr(f, part, None)
if p: if p:
f.backup()
p.decode() p.decode()
updated.append(f) updated.append(f)
ctx.master.addons.trigger("update", updated) ctx.master.addons.trigger("update", updated)
@ -178,6 +179,7 @@ class Core:
for f in flows: for f in flows:
p = getattr(f, part, None) p = getattr(f, part, None)
if p: if p:
f.backup()
current_enc = p.headers.get("content-encoding", "identity") current_enc = p.headers.get("content-encoding", "identity")
if current_enc == "identity": if current_enc == "identity":
p.encode("deflate") p.encode("deflate")
@ -204,6 +206,7 @@ class Core:
if p: if p:
current_enc = p.headers.get("content-encoding", "identity") current_enc = p.headers.get("content-encoding", "identity")
if current_enc == "identity": if current_enc == "identity":
f.backup()
p.encode(enc) p.encode(enc)
updated.append(f) updated.append(f)
ctx.master.addons.trigger("update", updated) ctx.master.addons.trigger("update", updated)

View File

@ -390,6 +390,8 @@ class ConsoleAddon:
# but for now it is. # but for now it is.
if not flow: if not flow:
raise exceptions.CommandError("No flow selected.") raise exceptions.CommandError("No flow selected.")
flow.backup()
require_dummy_response = ( require_dummy_response = (
part in ("response-headers", "response-body", "set-cookies") and part in ("response-headers", "response-body", "set-cookies") and
flow.response is None flow.response is None