Skip to content

Commit 8a1cb6f

Browse files
committed
feat: DemoController 添加测试接口
1 parent 47bfc72 commit 8a1cb6f

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

http/DemoController.http

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ POST http://localhost:8080/api/demo/string
44
Content-Type: application/json
55

66
###
7+
# 测试 map 类型的返回
8+
POST http://localhost:8080/api/demo/m
9+
Content-Type: application/json
10+
11+
###

src/main/java/info/cadecode/simple/controller/DemoController.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package info.cadecode.simple.controller;
22

3+
import info.cadecode.simple.common.response.SimpleRes;
34
import org.springframework.web.bind.annotation.PostMapping;
45
import org.springframework.web.bind.annotation.RequestMapping;
56
import org.springframework.web.bind.annotation.RestController;
67

8+
import java.util.HashMap;
9+
import java.util.Map;
10+
711
/**
812
* @author Cade Li
913
* @date 2021/7/15
@@ -17,4 +21,13 @@ public class DemoController {
1721
public String string() {
1822
return "DemoController OK!";
1923
}
24+
25+
@PostMapping("map")
26+
public Map<String, Object> map() {
27+
HashMap<String, Object> map = new HashMap<>();
28+
map.put("name", "map");
29+
map.put("msg", "hello world");
30+
return map;
31+
}
32+
2033
}

0 commit comments

Comments
 (0)