diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java b/backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java index 6f7705104e..ca7855311a 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/request/HttpRequest.java @@ -47,4 +47,6 @@ public class HttpRequest implements Request { private Long connectTimeout; @JSONField(ordinal = 15) private Long responseTimeout; + @JSONField(ordinal = 16) + private Boolean followRedirects;; } diff --git a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue index 6ca146367a..d58dcfc0ff 100644 --- a/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue +++ b/frontend/src/business/components/api/test/components/request/ApiHttpRequestForm.vue @@ -38,6 +38,7 @@ v-model="request.useEnvironment" :active-text="$t('api_test.request.refer_to_environment')" @change="useEnvironmentChange"> + {{$t('api_test.request.follow_redirects')}} {{ $t('api_test.request.debug') }} @@ -221,4 +222,8 @@ export default { color: #F56C6C; } +.follow-redirects-item { + margin-left: 30px; +} + diff --git a/frontend/src/business/components/api/test/model/JMX.js b/frontend/src/business/components/api/test/model/JMX.js index c0c52fbf79..8f05355f91 100644 --- a/frontend/src/business/components/api/test/model/JMX.js +++ b/frontend/src/business/components/api/test/model/JMX.js @@ -295,8 +295,10 @@ export class HTTPSamplerProxy extends DefaultTestElement { if (options.responseTimeout) { this.stringProp('HTTPSampler.response_timeout', options.responseTimeout); } + if (options.followRedirects) { + this.boolProp('HTTPSampler.follow_redirects', options.followRedirects, true); + } - this.boolProp("HTTPSampler.follow_redirects", options.follow, true); this.boolProp("HTTPSampler.use_keepalive", options.keepalive, true); } } diff --git a/frontend/src/business/components/api/test/model/ScenarioModel.js b/frontend/src/business/components/api/test/model/ScenarioModel.js index 3a1d49d2da..f457c861c2 100644 --- a/frontend/src/business/components/api/test/model/ScenarioModel.js +++ b/frontend/src/business/components/api/test/model/ScenarioModel.js @@ -312,6 +312,7 @@ export class HttpRequest extends Request { this.enable = true; this.connectTimeout = 60*1000; this.responseTimeout = undefined; + this.followRedirects = true; this.set(options); this.sets({parameters: KeyValue, headers: KeyValue}, options); @@ -749,6 +750,7 @@ class JMXHttpRequest { } this.connectTimeout = request.connectTimeout; this.responseTimeout = request.responseTimeout; + this.followRedirects = request.followRedirects; } } @@ -867,11 +869,11 @@ class JMXGenerator { } } - this.addBeanShellProcessor(sampler, request); + this.addRequestExtractor(sampler, request); this.addRequestAssertion(sampler, request); - this.addRequestExtractor(sampler, request); + this.addBeanShellProcessor(sampler, request); threadGroup.put(sampler); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 398045b91b..c36df756a4 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -448,6 +448,7 @@ export default { timeout_config: "Timeout Config", connect_timeout: "Connect Timeout", response_timeout: "Response Timeout", + follow_redirects: "Follow Redirects", body_upload_limit_size: "The file size does not exceed 500 MB", assertions: { label: "Assertion", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 53136704ea..e97f5f244c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -449,6 +449,7 @@ export default { timeout_config: "超时设置", connect_timeout: "连接超时", response_timeout: "响应超时", + follow_redirects: "跟隨重定向", body_upload_limit_size: "上传文件大小不能超过 500 MB!", assertions: { label: "断言",