File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
src/main/java/com/codingapi/springboot/example/controller Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 11package com .codingapi .springboot .example .controller ;
22
33import com .codingapi .springboot .framework .dto .response .Response ;
4- import com .codingapi .springboot .framework .dto .response .SingleResponse ;
54import com .codingapi .springboot .framework .exception .LocaleMessageException ;
65import org .springframework .security .access .prepost .PreAuthorize ;
76import org .springframework .security .core .context .SecurityContextHolder ;
109import org .springframework .web .bind .annotation .RestController ;
1110
1211@ RestController
13- @ RequestMapping ("/demo " )
12+ @ RequestMapping ("/api " )
1413public 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}
You can’t perform that action at this time.
0 commit comments