diff --git a/client/components/Postman/Postman.js b/client/components/Postman/Postman.js index 279ea9ef..c4bdd48c 100644 --- a/client/components/Postman/Postman.js +++ b/client/components/Postman/Postman.js @@ -34,6 +34,7 @@ export default class Run extends Component { bodyForm: [], headers: [], currDomain: '', + caseEnv: '', bodyType: '', bodyOther: '', isDidMount: false @@ -75,37 +76,37 @@ export default class Run extends Component { req_body_form = [], basepath = '', env = [], - domain = '' + case_env = '' } = data; // case 任意编辑 pathname,不管项目的 basepath const pathname = (type === 'inter' ? (basepath + url) : url).replace(/\/+/g, '/'); - let hasContentType = false; - req_headers.forEach(headerItem => { - // TODO 'Content-Type' 排除大小写不同格式影响 - if (headerItem.name === 'Content-Type'){ - hasContentType = true; - headerItem.value = headerItem.value || 'application/x-www-form-urlencoded'; - } - }) - if (!hasContentType) { - req_headers.push({name: 'Content-Type', value: 'application/x-www-form-urlencoded'}); - } - const domains = env.concat(); - if (domain && !env.find(item => item.domain === domain)) { - domains.push({name: 'default', domain}) - } + // let hasContentType = false; + // req_headers.forEach(headerItem => { + // // TODO 'Content-Type' 排除大小写不同格式影响 + // if (headerItem.name === 'Content-Type'){ + // hasContentType = true; + // headerItem.value = headerItem.value || 'application/x-www-form-urlencoded'; + // } + // }) + // if (!hasContentType) { + // req_headers.push({name: 'Content-Type', value: 'application/x-www-form-urlencoded'}); + // } + // const domains = env.concat(); + // if (domain && !env.find(item => item.domain === domain)) { + // domains.push({name: 'default', domain}) + // } this.setState({ method, - domains, + domains: env.concat(), pathParam: req_params.concat(), pathname, query: req_query.concat(), bodyForm: req_body_form.concat(), headers: req_headers.concat(), bodyOther: req_body_other, - currDomain: domain || (env[0] && env[0].domain), + caseEnv: case_env || (env[0] && env[0].name), bodyType: req_body_type || 'form', loading: false }, () => { @@ -169,7 +170,7 @@ export default class Run extends Component { @autobind selectDomain(value) { - this.setState({ currDomain: value }); + this.setState({ caseEnv: value }); } @autobind @@ -404,7 +405,7 @@ export default class Run extends Component { render () { - const { method, domains, pathParam, pathname, query, headers, bodyForm, currDomain, bodyType, resHeader } = this.state; + const { method, domains, pathParam, pathname, query, headers, bodyForm, caseEnv, bodyType, resHeader } = this.state; const hasPlugin = this.hasCrossRequestPlugin(); const isResJson = resHeader && resHeader['content-type'] && resHeader['content-type'].indexOf('application/json') !== -1 let path = pathname; @@ -452,9 +453,9 @@ export default class Run extends Component { - { - domains.map((item, index) => ()) + domains.map((item, index) => ()) } diff --git a/client/containers/Project/Interface/InterfaceCol/InterfaceCaseContent.js b/client/containers/Project/Interface/InterfaceCol/InterfaceCaseContent.js index 3c830f0f..af523d33 100644 --- a/client/containers/Project/Interface/InterfaceCol/InterfaceCaseContent.js +++ b/client/containers/Project/Interface/InterfaceCol/InterfaceCaseContent.js @@ -85,7 +85,7 @@ export default class InterfaceCaseContent extends Component { updateCase = async () => { const { - currDomain: domain, + caseEnv: case_env, pathname: path, method, pathParam: req_params, @@ -99,7 +99,7 @@ export default class InterfaceCaseContent extends Component { const res = await axios.post('/api/col/up_case', { id, casename, - domain, + case_env, path, method, req_params, diff --git a/client/containers/Project/Interface/InterfaceList/Run/Run.js b/client/containers/Project/Interface/InterfaceList/Run/Run.js index aa24f43e..a6eba675 100644 --- a/client/containers/Project/Interface/InterfaceList/Run/Run.js +++ b/client/containers/Project/Interface/InterfaceList/Run/Run.js @@ -49,7 +49,7 @@ export default class Run extends Component { const project_id = this.props.match.params.id; const interface_id = this.props.currInterface._id; const { - currDomain: domain, + caseEnv: case_env, pathname: path, method, pathParam: req_params, @@ -64,7 +64,7 @@ export default class Run extends Component { casename: caseName, col_id: colId, project_id, - domain, + case_env, path, method, req_params,