diff --git a/client/components/Postman/Postman.js b/client/components/Postman/Postman.js index bf7a67f9..62759e64 100644 --- a/client/components/Postman/Postman.js +++ b/client/components/Postman/Postman.js @@ -8,7 +8,7 @@ import URL from 'url'; import './Postman.scss' -// const { TextArea } = Input; +const { TextArea } = Input; const InputGroup = Input.Group; const Option = Select.Option; const Panel = Collapse.Panel; @@ -25,8 +25,8 @@ export default class Run extends Component { } state = { - res: '', - resHeader: '', + res: {}, + resHeader: {}, method: 'GET', domains: [], pathname: '', @@ -55,7 +55,7 @@ export default class Run extends Component { componentDidMount() { const { bodyType } = this.state; - if(bodyType !== 'file' && bodyType !== 'form') { + if(bodyType && bodyType !== 'file' && bodyType !== 'form') { this.loadBodyEditor() } } @@ -109,7 +109,7 @@ export default class Run extends Component { bodyType: req_body_type || 'form', loading: false }, () => { - if(req_body_type !== 'file' && req_body_type !== 'form') { + if(req_body_type && req_body_type !== 'file' && req_body_type !== 'form') { this.loadBodyEditor() } }); @@ -404,8 +404,9 @@ export default class Run extends Component { render () { - const { method, domains, pathParam, pathname, query, headers, bodyForm, currDomain, bodyType } = this.state; + const { method, domains, pathParam, pathname, query, headers, bodyForm, currDomain, bodyType, resHeader } = this.state; const hasPlugin = this.hasCrossRequestPlugin(); + const isResJson = resHeader['content-type'] && resHeader['content-type'].indexOf('application/json') !== -1 let path = pathname; pathParam.forEach(item => { path = path.replace(`:${item.name}`, item.value || `:${item.name}`); @@ -580,11 +581,12 @@ export default class Run extends Component {
- {/**/} -
+ >
{/*