mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
fix: add single-file upload
This commit is contained in:
parent
37b30df564
commit
b7520e7fc0
@ -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>
|
||||
}
|
||||
{/*
|
||||
|
@ -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} >
|
||||
|
Loading…
Reference in New Issue
Block a user