fix: add single-file upload

This commit is contained in:
suxiaoxin 2017-09-09 09:11:08 +08:00
parent 37b30df564
commit b7520e7fc0
2 changed files with 6 additions and 5 deletions

View File

@ -204,6 +204,7 @@ export default class Run extends Component {
headers: this.getHeadersObj(headers),
data: bodyType === 'form' ? this.arrToObj(bodyForm) : bodyOther,
files: bodyType === 'form' ? this.getFiles(bodyForm) : {},
file: bodyType === 'file' ? 'single-file' : null,
success: (res, header) => {
try {
if(isJsonData(header)){
@ -673,9 +674,9 @@ export default class Run extends Component {
</div>
}
{
method === 'POST' && bodyType === 'file' &&
HTTP_METHOD[method].request_body && bodyType === 'file' &&
<div>
<Input type="file"></Input>
<Input type="file" id="single-file"></Input>
</div>
}
{/*

View File

@ -523,7 +523,7 @@ class InterfaceEditForm extends Component {
<RadioGroup>
<Radio value="form">form</Radio>
<Radio value="json">json</Radio>
{/* <Radio value="file">file</Radio> */}
<Radio value="file">file</Radio>
<Radio value="raw">raw</Radio>
</RadioGroup>
)}
@ -556,7 +556,7 @@ class InterfaceEditForm extends Component {
</Col>
</Row>
{/* {this.props.form.getFieldValue('req_body_type') === 'file' ?
{this.props.form.getFieldValue('req_body_type') === 'file' ?
<Row className="interface-edit-item" >
<Col span={18} offset={4}>
{getFieldDecorator('req_body_other', { initialValue: this.state.req_body_other })(
@ -568,7 +568,7 @@ class InterfaceEditForm extends Component {
</Row>
:
null
} */}
}
{this.props.form.getFieldValue('req_body_type') === 'raw' ?
<Row>
<Col span={18} offset={4} >