fix flow edit

This commit is contained in:
Maximilian Hils 2016-07-25 17:31:37 -07:00
parent aee693a5c0
commit 67bfc1df14
3 changed files with 26 additions and 16 deletions

View File

@ -64,17 +64,6 @@
}
}
.header-table .inline-input {
display: inline-block;
width: 100%;
height: 100%;
}
.header-colon {
position: absolute;
opacity: 0;
}
.view-options {
margin-top: 10px;
}
@ -117,6 +106,19 @@
.header-value {
}
// This exists so that you can copy
// and paste headers out of mitmweb.
.header-colon {
position: absolute;
opacity: 0;
}
.inline-input {
display: inline-block;
width: 100%;
height: 100%;
}
}
.connection-table, .timing-table {

View File

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

View File

@ -126,7 +126,8 @@ export default class Headers extends Component {
onDone={val => this.onChange(i, 0, val)}
onRemove={event => this.onRemove(i, 0, event)}
onTab={event => this.onTab(i, 0, event)}
/><span className="header-colon">:</span>
/>
<span className="header-colon">:</span>
</td>
<td className="header-value">
<HeaderEditor