From 8473be825f19bb9296b10a659a752bc990804607 Mon Sep 17 00:00:00 2001 From: tanghc Date: Wed, 3 Apr 2019 19:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E7=A0=81500BUG=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gatewaycommon/zuul/configuration/ZuulErrorController.java | 2 ++ .../com/gitee/sop/bookweb/controller/AlipayController.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java index 8d0111ca..a2f9c135 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/zuul/configuration/ZuulErrorController.java @@ -5,6 +5,7 @@ import com.gitee.sop.gatewaycommon.result.ResultExecutor; import com.netflix.zuul.context.RequestContext; import lombok.extern.slf4j.Slf4j; import org.springframework.boot.web.servlet.error.ErrorController; +import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -27,6 +28,7 @@ public class ZuulErrorController implements ErrorController { @ResponseBody public Object error() { RequestContext ctx = RequestContext.getCurrentContext(); + ctx.setResponseStatusCode(HttpStatus.OK.value()); Throwable throwable = ctx.getThrowable(); return this.buildResult(throwable); } diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/bookweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/bookweb/controller/AlipayController.java index 3c378faa..6d9741ed 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/bookweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/bookweb/controller/AlipayController.java @@ -28,7 +28,7 @@ public class AlipayController { StoryVO storyVO = new StoryVO(); storyVO.id = 1L; storyVO.name = "白雪公主"; - storyVO.gmtCreate = new Date(); + storyVO.gmt_create = new Date(); return storyVO; } @@ -41,6 +41,6 @@ public class AlipayController { public static class StoryVO { private Long id; private String name; - private Date gmtCreate; + private Date gmt_create; } }