diff --git a/mitmproxy/web/app.py b/mitmproxy/web/app.py index 56f7f67dc..eaef887ad 100644 --- a/mitmproxy/web/app.py +++ b/mitmproxy/web/app.py @@ -8,6 +8,7 @@ import re import six import tornado.websocket +import tornado.web from io import BytesIO from mitmproxy.flow import FlowWriter, FlowReader @@ -293,19 +294,11 @@ class ReplayFlow(RequestHandler): class FlowContent(RequestHandler): - def post (self, flow_id, message): - # handle request later now just change response content - - flow = self.flow - flow.backup() - content = self.request.files.values()[0][0].body - if (message == "response"): - with models.decoded(flow.response): - flow.response.content = content - elif(message == "request"): - with models.decoded(flow.request): - flow.request.content = content - self.state.update_flow(flow) + def post(self, flow_id, message): + self.flow.backup() + message = getattr(self.flow, message) + message.content = self.request.files.values()[0][0].body + self.state.update_flow(self.flow) def get(self, flow_id, message): message = getattr(self.flow, message)