fix(接口测试): 接口CASE-请求体选择x-www-form-urlencoded时,参数默认编码开启

--bug=1013407 --user=赵勇 【接口测试】接口CASE-请求体选择x-www-form-urlencoded时,参数默认编码应该开启 https://www.tapd.cn/55049933/s/1162456
This commit is contained in:
fit2-zhao 2022-05-23 19:16:17 +08:00 committed by f2c-ci-robot[bot]
parent 9dbd21e75b
commit ef4b705489
2 changed files with 12 additions and 0 deletions

View File

@ -108,6 +108,10 @@ export default {
name: "MsApiVariable",
components: {ApiVariableSetting, MsApiBodyFileUpload, MsApiVariableAdvance, MsApiVariableJson},
props: {
urlEncode: {
type: Boolean,
default: false
},
keyPlaceholder: String,
valuePlaceholder: String,
description: String,
@ -220,6 +224,7 @@ export default {
this.parameters.push(new KeyValue({
type: 'text',
enable: true,
urlEncode: this.urlEncode,
uuid: this.uuid(),
required: false,
contentType: 'text/plain'
@ -309,6 +314,7 @@ export default {
type: 'text',
enable: true,
required: false,
urlEncode: this.urlEncode,
uuid: this.uuid(),
contentType: 'text/plain'
}));

View File

@ -33,6 +33,7 @@
:with-mor-setting="true"
:is-read-only="isReadOnly"
:parameters="body.kvs"
:urlEncode="body.type == 'WWW_FORM'"
:isShowEnable="isShowEnable"
:scenario-definition="scenarioDefinition"
@editScenarioAdvance="editScenarioAdvance"
@ -249,6 +250,11 @@ export default {
isType = true;
}
})
if(this.body && this.body.kvs && value === "application/x-www-form-urlencoded") {
this.body.kvs.forEach(item => {
item.urlEncode = true;
});
}
if (!isType) {
this.headers.unshift(new KeyValue({name: "Content-Type", value: value}));
this.$emit('headersChange');