Skip to content

Commit 89dab62

Browse files
committed
add test.sh
1 parent 1bbc350 commit 89dab62

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

springboot-example/api/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
### url test
2+
3+
# login test
4+
curl -X POST http://localhost:8090/user/login -d '{"username":"admin","password":"admin"}' -H "Content-Type: application/json"
5+
6+
# index test
7+
curl -X GET http://localhost:8090/api/index -H "Content-Type: application/json" -H "Authorization:eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJhdXRob3JpdGllc1wiOltcIlJPTEVfQURNSU5cIl0sXCJleHBpcmVcIjpmYWxzZSxcImV4cGlyZVRpbWVcIjoxNjU4MTkxMjExODY5LFwicmVtaW5kVGltZVwiOjE2NTgxOTA5MTE4NjksXCJ1c2VybmFtZVwiOlwiYWRtaW5cIn0ifQ.2S_6NyzaBUBVAQrKeUY-YSMeCIkry-a4Lt5tBThp97Inz-hSGMMe--DT_oeoR4wgBQ6OcYOaW4ZseKZ3H1XIMw"
8+
9+
# error test
10+
curl -X GET http://localhost:8090/api/error -H "Content-Type: application/json" -H "Authorization:eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ7XCJhdXRob3JpdGllc1wiOltcIlJPTEVfQURNSU5cIl0sXCJleHBpcmVcIjpmYWxzZSxcImV4cGlyZVRpbWVcIjoxNjU4MTkxMjExODY5LFwicmVtaW5kVGltZVwiOjE2NTgxOTA5MTE4NjksXCJ1c2VybmFtZVwiOlwiYWRtaW5cIn0ifQ.2S_6NyzaBUBVAQrKeUY-YSMeCIkry-a4Lt5tBThp97Inz-hSGMMe--DT_oeoR4wgBQ6OcYOaW4ZseKZ3H1XIMw"
11+
12+
# logout test
13+
curl -X GET http://localhost:8090/user/logout
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.codingapi.springboot.example.controller;
22

33
import com.codingapi.springboot.framework.dto.response.Response;
4-
import com.codingapi.springboot.framework.dto.response.SingleResponse;
54
import com.codingapi.springboot.framework.exception.LocaleMessageException;
65
import org.springframework.security.access.prepost.PreAuthorize;
76
import org.springframework.security.core.context.SecurityContextHolder;
@@ -10,7 +9,7 @@
109
import org.springframework.web.bind.annotation.RestController;
1110

1211
@RestController
13-
@RequestMapping("/demo")
12+
@RequestMapping("/api")
1413
public class DemoController {
1514

1615
@GetMapping("/index")
@@ -20,17 +19,9 @@ public String index(){
2019
return "hello:"+loginUserName;
2120
}
2221

23-
2422
@GetMapping("/error")
2523
public Response error(){
2624
throw new LocaleMessageException("hello.error");
2725
}
2826

29-
@GetMapping("/hello")
30-
public SingleResponse<String> hello(){
31-
return SingleResponse.of("hello");
32-
}
33-
34-
35-
3627
}

0 commit comments

Comments
 (0)