Skip to content

Commit 563f827

Browse files
committed
chore: update the order of interceptors
Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
1 parent d4cd2a6 commit 563f827

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func (p *Plugin) createGRPCserver(interceptors map[string]api.Interceptor) (*grp
3535

3636
// if we have interceptors in the config, we need to chain them with our interceptor, and add them to the server options
3737
if len(p.config.Interceptors) > 0 && len(interceptors) > 0 {
38-
// we need to loop backwards, since the last interceptor in the list should be the first one to execute
39-
for i := len(p.config.Interceptors) - 1; i >= 0; i-- {
38+
// apply interceptors in the same order as they are configured
39+
for i := 0; i < len(p.config.Interceptors); i++ {
4040
name := p.config.Interceptors[i]
4141
if _, ok := interceptors[name]; !ok {
4242
// we should raise an error here, since we may silently ignore let's say auth interceptor, which is critical for security

tests/configs/.rr-grpc-rq-interceptors.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ grpc:
1919
- "proto/service/service.proto"
2020

2121
interceptors:
22-
- "interceptor2"
2322
- "interceptor1"
23+
- "interceptor2"
2424

2525
max_send_msg_size: 50
2626
max_recv_msg_size: 50

0 commit comments

Comments
 (0)