mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
combine content with header updates
This commit is contained in:
parent
61ef7ca91b
commit
ca4541613c
@ -251,11 +251,14 @@ class FlowHandler(RequestHandler):
|
|||||||
request.port = int(v)
|
request.port = int(v)
|
||||||
elif k == "headers":
|
elif k == "headers":
|
||||||
request.headers.set_state(v)
|
request.headers.set_state(v)
|
||||||
|
elif k == "content":
|
||||||
|
request.text = v
|
||||||
else:
|
else:
|
||||||
print("Warning: Unknown update {}.{}: {}".format(a, k, v))
|
print("Warning: Unknown update {}.{}: {}".format(a, k, v))
|
||||||
|
|
||||||
elif a == "response":
|
elif a == "response":
|
||||||
response = flow.response
|
response = flow.response
|
||||||
|
|
||||||
for k, v in six.iteritems(b):
|
for k, v in six.iteritems(b):
|
||||||
if k == "msg":
|
if k == "msg":
|
||||||
response.msg = str(v)
|
response.msg = str(v)
|
||||||
@ -265,6 +268,8 @@ class FlowHandler(RequestHandler):
|
|||||||
response.http_version = str(v)
|
response.http_version = str(v)
|
||||||
elif k == "headers":
|
elif k == "headers":
|
||||||
response.headers.set_state(v)
|
response.headers.set_state(v)
|
||||||
|
elif k == "content":
|
||||||
|
response.text = v
|
||||||
else:
|
else:
|
||||||
print("Warning: Unknown update {}.{}: {}".format(a, k, v))
|
print("Warning: Unknown update {}.{}: {}".format(a, k, v))
|
||||||
else:
|
else:
|
||||||
|
@ -94,15 +94,6 @@ export function updateEdit(update) {
|
|||||||
export function stopEdit(flow, modified_flow) {
|
export function stopEdit(flow, modified_flow) {
|
||||||
let diff = getDiff(flow, modified_flow)
|
let diff = getDiff(flow, modified_flow)
|
||||||
return (dispatch) => {
|
return (dispatch) => {
|
||||||
if (diff.response && diff.response.content) {
|
|
||||||
dispatch(flowsActions.updateContent(flow, diff.response.content, "response"))
|
|
||||||
delete diff.response.content
|
|
||||||
}
|
|
||||||
if (diff.request && diff.request.content) {
|
|
||||||
dispatch(flowsActions.updateContent(flow, diff.request.content, "request"))
|
|
||||||
delete diff.request.content
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatch(flowsActions.update(flow, diff)).then(() => {
|
dispatch(flowsActions.update(flow, diff)).then(() => {
|
||||||
dispatch(flowsActions.updateFlow(modified_flow))
|
dispatch(flowsActions.updateFlow(modified_flow))
|
||||||
dispatch({ type: STOP_EDIT })
|
dispatch({ type: STOP_EDIT })
|
||||||
|
Loading…
Reference in New Issue
Block a user