mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
fix: path params 不经过 mock 处理和 headers 参数没有经过mock 处理
This commit is contained in:
parent
8fd427e910
commit
1fb1a914ca
@ -198,9 +198,10 @@ export default class Run extends Component {
|
||||
}
|
||||
const { headers, bodyForm, pathParam, bodyOther, caseEnv, domains, method, pathname, query, bodyType } = this.state;
|
||||
const urlObj = URL.parse(_.find(domains, item => item.name === caseEnv).domain);
|
||||
let path = pathname
|
||||
let path = pathname;
|
||||
|
||||
pathParam.forEach(item => {
|
||||
path = path.replace(`:${item.name}`, item.value || `:${item.name}`);
|
||||
path = path.replace(`:${item.name}`, handleMockWord(item.value) || `:${item.name}`);
|
||||
});
|
||||
if (urlObj.pathname) {
|
||||
if (urlObj.pathname[urlObj.pathname.length - 1] !== '/') {
|
||||
@ -497,7 +498,7 @@ export default class Run extends Component {
|
||||
const headersObj = {};
|
||||
headers.forEach(item => {
|
||||
if (item.name && item.value) {
|
||||
headersObj[item.name] = item.value;
|
||||
headersObj[item.name] = handleMockWord(item.value);
|
||||
}
|
||||
})
|
||||
return headersObj;
|
||||
|
@ -400,7 +400,7 @@ class InterfaceColContent extends Component {
|
||||
const headersObj = {};
|
||||
headers.forEach(item => {
|
||||
if (item.name && item.value) {
|
||||
headersObj[item.name] = item.value;
|
||||
headersObj[item.name] = this.handleValue(item.value);
|
||||
}
|
||||
})
|
||||
return headersObj;
|
||||
|
@ -142,7 +142,7 @@ class interfaceColController extends baseController{
|
||||
result.path = projectData.basepath + data.path;
|
||||
result.method = data.method;
|
||||
result.req_body_type = data.req_body_type;
|
||||
result.req_headers = data.req_headers;
|
||||
result.req_headers = this.handleParamsValue(data.req_headers, result.req_headers);
|
||||
result.res_body = data.res_body;
|
||||
result.res_body_type = data.res_body_type;
|
||||
|
||||
@ -397,7 +397,7 @@ class interfaceColController extends baseController{
|
||||
result.path = projectData.basepath + data.path;
|
||||
result.method = data.method;
|
||||
result.req_body_type = data.req_body_type;
|
||||
result.req_headers = data.req_headers;
|
||||
result.req_headers = this.handleParamsValue(data.req_headers, result.req_headers);
|
||||
result.res_body = data.res_body;
|
||||
result.res_body_type = data.res_body_type;
|
||||
result.req_body_form = this.handleParamsValue(data.req_body_form, result.req_body_form)
|
||||
|
@ -22,6 +22,9 @@ class interfaceCase extends baseModel {
|
||||
req_params: [{
|
||||
name: String, value: String
|
||||
}],
|
||||
req_headers: [{
|
||||
name: String, value: String
|
||||
}],
|
||||
req_query: [{
|
||||
name: String, value: String, enable: {type: Boolean, default: true}
|
||||
}],
|
||||
|
Loading…
Reference in New Issue
Block a user