Skip to content

Commit 06fe26a

Browse files
authored
fix: use slices.Contains instead of loop iteration (#409)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 5027d1e commit 06fe26a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

internal/api/api.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package api
1717
import (
1818
"fmt"
1919
"os"
20+
"slices"
2021

2122
_ "github.com/blinklabs-io/cardano-node-api/docs" // docs is generated by Swag CLI
2223
"github.com/blinklabs-io/cardano-node-api/internal/config"
@@ -70,10 +71,8 @@ func Start(cfg *config.Config) error {
7071
}
7172
accessMiddleware := func(c *gin.Context) {
7273
// Skip handling/logging for specified paths
73-
for _, path := range skipPaths {
74-
if c.Request.URL.Path == path {
75-
return
76-
}
74+
if slices.Contains(skipPaths, c.Request.URL.Path) {
75+
return
7776
}
7877
accessLogger.Info(
7978
"request received",

0 commit comments

Comments
 (0)