refactor(接口测试): 测试报告自动选择json模式,前后置脚本添加全局变量模版

This commit is contained in:
chenjianxing 2020-09-28 15:50:12 +08:00
parent 45d0f00003
commit 01a9eb3d83
5 changed files with 27 additions and 6 deletions

View File

@ -63,6 +63,13 @@
this.mode = mode;
}
},
created() {
console.log(this.response.headers);
if (this.response.headers.indexOf("Content-Type: application/json") > 0) {
this.mode = BODY_FORMAT.JSON;
}
}
}
</script>

View File

@ -38,7 +38,15 @@
},
{
title: this.$t('api_test.request.processor.code_template_set_variable'),
value: 'vars.put("variable_name", "variable_value");',
value: 'vars.put("variable_name", "variable_value")',
},
{
title: this.$t('api_test.request.processor.code_template_get_global_variable'),
value: '${__P("variable_name")}',
},
{
title: this.$t('api_test.request.processor.code_template_set_global_variable'),
value: '${__setProperty("variable_name","variable_value",)}',
},
{
title: this.$t('api_test.request.processor.code_template_get_response_header'),

View File

@ -537,11 +537,13 @@ export default {
post_exec_script: "PostProcessor",
code_template: "Code template",
bean_shell_processor_tip: "Currently only BeanShell scripts are supported",
code_template_get_variable: "Get variable",
code_template_set_variable: "Set variable",
code_template_get_response_header: "Get response header",
code_template_get_response_code: "Get response code",
code_template_get_response_result: "Get response result"
code_template_get_variable: "Get Variable",
code_template_set_variable: "Set Variable",
code_template_get_global_variable: "Get Global Variable",
code_template_set_global_variable: "Set Global variable",
code_template_get_response_header: "Get Response Header",
code_template_get_response_code: "Get Response Code",
code_template_get_response_result: "Get Response Result"
},
dubbo: {
protocol: "protocol",

View File

@ -540,6 +540,8 @@ export default {
bean_shell_processor_tip: "仅支持 BeanShell 脚本",
code_template_get_variable: "获取变量",
code_template_set_variable: "设置变量",
code_template_get_global_variable: "获取全局变量",
code_template_set_global_variable: "设置全局变量",
code_template_get_response_header: "获取响应头",
code_template_get_response_code: "获取响应码",
code_template_get_response_result: "获取响应结果"

View File

@ -540,6 +540,8 @@ export default {
bean_shell_processor_tip: "僅支持 BeanShell 腳本",
code_template_get_variable: "獲取變量",
code_template_set_variable: "設置變量",
code_template_get_global_variable: "獲取全局變量",
code_template_set_global_variable: "設置全局變量",
code_template_get_response_header: "獲取響應頭",
code_template_get_response_code: "獲取響應碼",
code_template_get_response_result: "獲取響應結果"