aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/components/ContentView/ContentLoader.jsx
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-25 17:31:37 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-25 17:31:37 -0700
commit67bfc1df147f8a6daa847146625d8887a44ac338 (patch)
treed0ad97bcba01b4fe97e432755e5bc47395e75cee /web/src/js/components/ContentView/ContentLoader.jsx
parentaee693a5c0dc5b3c0bb783acf949fb4ba0886a06 (diff)
downloadmitmproxy-67bfc1df147f8a6daa847146625d8887a44ac338.tar.gz
mitmproxy-67bfc1df147f8a6daa847146625d8887a44ac338.tar.bz2
mitmproxy-67bfc1df147f8a6daa847146625d8887a44ac338.zip
fix flow edit
Diffstat (limited to 'web/src/js/components/ContentView/ContentLoader.jsx')
-rw-r--r--web/src/js/components/ContentView/ContentLoader.jsx15
1 files changed, 11 insertions, 4 deletions
diff --git a/web/src/js/components/ContentView/ContentLoader.jsx b/web/src/js/components/ContentView/ContentLoader.jsx
index 697085a9..094ce18b 100644
--- a/web/src/js/components/ContentView/ContentLoader.jsx
+++ b/web/src/js/components/ContentView/ContentLoader.jsx
@@ -22,12 +22,15 @@ export default View => class extends React.Component {
}
componentWillMount() {
- this.startRequest(this.props)
+ this.updateContent(this.props)
}
componentWillReceiveProps(nextProps) {
- if (nextProps.message.contentHash !== this.props.message.contentHash) {
- this.startRequest(nextProps)
+ if (
+ nextProps.message.content !== this.props.message.content ||
+ nextProps.message.contentHash !== this.props.message.contentHash
+ ) {
+ this.updateContent(nextProps)
}
}
@@ -37,13 +40,17 @@ export default View => class extends React.Component {
}
}
- startRequest(props) {
+ updateContent(props) {
if (this.state.request) {
this.state.request.abort()
}
+ // We have a few special cases where we do not need to make an HTTP request.
if(props.message.contentLength === 0 || props.message.contentLength === null){
return this.setState({request: undefined, content: ""})
}
+ if(props.message.content !== undefined) {
+ return this.setState({request: undefined, content: props.message.content})
+ }
let requestUrl = MessageUtils.getContentURL(props.flow, props.message)