combine content with header updates

This commit is contained in:
Clemens 2016-07-25 14:34:00 +02:00
parent 61ef7ca91b
commit ca4541613c
2 changed files with 5 additions and 9 deletions

View File

@ -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:

View File

@ -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 })