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 1
1
package com .codingapi .springboot .example .controller ;
2
2
3
3
import com .codingapi .springboot .framework .dto .response .Response ;
4
- import com .codingapi .springboot .framework .dto .response .SingleResponse ;
5
4
import com .codingapi .springboot .framework .exception .LocaleMessageException ;
6
5
import org .springframework .security .access .prepost .PreAuthorize ;
7
6
import org .springframework .security .core .context .SecurityContextHolder ;
10
9
import org .springframework .web .bind .annotation .RestController ;
11
10
12
11
@ RestController
13
- @ RequestMapping ("/demo " )
12
+ @ RequestMapping ("/api " )
14
13
public class DemoController {
15
14
16
15
@ GetMapping ("/index" )
@@ -20,17 +19,9 @@ public String index(){
20
19
return "hello:" +loginUserName ;
21
20
}
22
21
23
-
24
22
@ GetMapping ("/error" )
25
23
public Response error (){
26
24
throw new LocaleMessageException ("hello.error" );
27
25
}
28
26
29
- @ GetMapping ("/hello" )
30
- public SingleResponse <String > hello (){
31
- return SingleResponse .of ("hello" );
32
- }
33
-
34
-
35
-
36
27
}
You can’t perform that action at this time.
0 commit comments