diff --git a/backend/src/main/java/io/metersphere/controller/TestController.java b/backend/src/main/java/io/metersphere/controller/TestController.java
index 9783d985724e..2e2e761937e1 100644
--- a/backend/src/main/java/io/metersphere/controller/TestController.java
+++ b/backend/src/main/java/io/metersphere/controller/TestController.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.User;
import io.metersphere.commons.utils.SessionUtils;
+import io.metersphere.controller.handler.annotation.NoResultHolder;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@@ -34,6 +35,26 @@ public Object testMultipart(@RequestPart(value = "id") String id, @RequestPart(v
return jsonObject;
}
+ @NoResultHolder
+ @GetMapping(value = "/xml")
+ public String getXmlString() {
+ return "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ " Harry Potter\n" +
+ " 29.99\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ " Learning XML\n" +
+ " 39.95\n" +
+ "\n" +
+ "\n" +
+ "";
+ }
+
@GetMapping(value = "/{str}")
public Object getString(@PathVariable String str) throws InterruptedException {
if (StringUtils.equals("error", str)) {
diff --git a/backend/src/main/java/io/metersphere/controller/handler/ResultResponseBodyAdvice.java b/backend/src/main/java/io/metersphere/controller/handler/ResultResponseBodyAdvice.java
index 5f2e7e0ce35f..f83acde163e7 100644
--- a/backend/src/main/java/io/metersphere/controller/handler/ResultResponseBodyAdvice.java
+++ b/backend/src/main/java/io/metersphere/controller/handler/ResultResponseBodyAdvice.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import io.metersphere.controller.ResultHolder;
+import io.metersphere.controller.handler.annotation.NoResultHolder;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
@@ -30,6 +31,10 @@ public Object beforeBodyWrite(Object o, MethodParameter methodParameter, MediaTy
return null;
}
+ if (methodParameter.hasMethodAnnotation(NoResultHolder.class)) {
+ return o;
+ }
+
if (!(o instanceof ResultHolder)) {
if (o instanceof String) {
return JSON.toJSONString(ResultHolder.success(o));
diff --git a/backend/src/main/java/io/metersphere/controller/handler/annotation/NoResultHolder.java b/backend/src/main/java/io/metersphere/controller/handler/annotation/NoResultHolder.java
new file mode 100644
index 000000000000..f04c9845c46d
--- /dev/null
+++ b/backend/src/main/java/io/metersphere/controller/handler/annotation/NoResultHolder.java
@@ -0,0 +1,15 @@
+package io.metersphere.controller.handler.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Inherited
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NoResultHolder {
+}
diff --git a/pom.xml b/pom.xml
index 27f82b6fa661..02418e0d2ea6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
2.2.6.RELEASE
-
+
metersphere
frontend