File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
sample-apps/SpringBoot2.7Postgres/src/main/java/com/example/demo Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 20
20
)
21
21
22
22
spring_boot_postgres_app .test_all_payloads ()
23
+ spring_boot_postgres_app .test_blocking ()
24
+ spring_boot_postgres_app .test_rate_limiting ()
Original file line number Diff line number Diff line change @@ -44,4 +44,10 @@ public String benchmark_route() throws InterruptedException {
44
44
Thread .sleep (1 ); // sleep 1ms
45
45
return "OK" ;
46
46
}
47
+
48
+ @ GetMapping ("/test_ratelimiting_1" )
49
+ @ ResponseBody
50
+ public String test_ratelimiting_route () throws InterruptedException {
51
+ return "OK" ;
52
+ }
47
53
}
Original file line number Diff line number Diff line change 1
1
package com .example .demo ;
2
2
3
+ import dev .aikido .agent_api .SetUser ;
3
4
import org .springframework .core .annotation .Order ;
4
5
import org .springframework .stereotype .Component ;
5
6
6
7
import javax .servlet .*;
8
+ import javax .servlet .http .HttpServletRequest ;
7
9
import java .io .IOException ;
8
10
11
+ import static dev .aikido .agent_api .SetUser .setUser ;
12
+
9
13
10
14
@ Component
11
15
@ Order (0 )
@@ -16,7 +20,12 @@ public void doFilter(
16
20
ServletRequest request ,
17
21
ServletResponse response ,
18
22
FilterChain chain ) throws IOException , ServletException {
19
- //setUser(new SetUser.UserObject("123", "John Doe"));
23
+ HttpServletRequest httpRequest = (HttpServletRequest ) request ;
24
+ if (httpRequest .getHeader ("user" ) != null ) {
25
+ // Useful for end2end tests:
26
+ String id = httpRequest .getHeader ("user" );
27
+ setUser (new SetUser .UserObject (id , "John Doe" ));
28
+ }
20
29
chain .doFilter (request , response );
21
30
}
22
31
}
You can’t perform that action at this time.
0 commit comments