diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java index 5215183d..b0530de1 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java @@ -18,6 +18,7 @@ import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -141,6 +142,17 @@ public class AlipayController { return story; } + // http://localhost:2222/getStory33 + // 遗留接口具备开放平台能力 + @ApiAbility + @PostMapping("getStory33") + public StoryResult getStory22(@RequestBody StoryParam param) { + StoryResult story = new StoryResult(); + story.setId(1L); + story.setName("遗留接口,param:" + param); + return story; + } + // http://localhost:2222/getStory2?version=2.1 // 遗留接口具备开放平台能力,在原来的基础上加版本号 @ApiAbility(version = "2.1") diff --git a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java index 793725c8..e60efc29 100644 --- a/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java +++ b/sop-test/src/test/java/com/gitee/sop/test/AllInOneTest.java @@ -64,6 +64,22 @@ public class AllInOneTest extends TestBase { client.execute(requestBuilder); } + /** + * 测试遗留接口 + * 以json方式提交(application/json) + */ + public void testPostJSON2() { + Client.RequestBuilder requestBuilder = new Client.RequestBuilder() + .method("getStory33") + .version("1.0") + // 以json方式提交 + .postJson(true) + .bizContent(new BizContent().add("id", "1").add("name", "葫芦娃")) + .httpMethod(HttpTool.HTTPMethod.POST); + + client.execute(requestBuilder); + } + /** * 测试feign。gateway -> book-service(consumer) -> story-service(provider) */