@@ -11,13 +11,13 @@ import (
1111func TestLoggingAuditor (t * testing.T ) {
1212 tests := []struct {
1313 name string
14- request * Request
14+ request Request
1515 expectedLevel string
1616 expectedFields []string
1717 }{
1818 {
1919 name : "allow request" ,
20- request : & Request {
20+ request : Request {
2121 Method : "GET" ,
2222 URL : "https://github.com" ,
2323 Allowed : true ,
@@ -28,7 +28,7 @@ func TestLoggingAuditor(t *testing.T) {
2828 },
2929 {
3030 name : "deny request" ,
31- request : & Request {
31+ request : Request {
3232 Method : "POST" ,
3333 URL : "https://example.com" ,
3434 Allowed : false ,
@@ -38,7 +38,7 @@ func TestLoggingAuditor(t *testing.T) {
3838 },
3939 {
4040 name : "allow with empty rule" ,
41- request : & Request {
41+ request : Request {
4242 Method : "PUT" ,
4343 URL : "https://api.github.com/repos" ,
4444 Allowed : true ,
@@ -49,7 +49,7 @@ func TestLoggingAuditor(t *testing.T) {
4949 },
5050 {
5151 name : "deny HTTPS request" ,
52- request : & Request {
52+ request : Request {
5353 Method : "GET" ,
5454 URL : "https://malware.bad.com/payload" ,
5555 Allowed : false ,
@@ -59,7 +59,7 @@ func TestLoggingAuditor(t *testing.T) {
5959 },
6060 {
6161 name : "allow with wildcard rule" ,
62- request : & Request {
62+ request : Request {
6363 Method : "POST" ,
6464 URL : "https://api.github.com/graphql" ,
6565 Allowed : true ,
@@ -70,7 +70,7 @@ func TestLoggingAuditor(t *testing.T) {
7070 },
7171 {
7272 name : "deny HTTP request" ,
73- request : & Request {
73+ request : Request {
7474 Method : "GET" ,
7575 URL : "http://insecure.example.com" ,
7676 Allowed : false ,
@@ -80,7 +80,7 @@ func TestLoggingAuditor(t *testing.T) {
8080 },
8181 {
8282 name : "allow HEAD request" ,
83- request : & Request {
83+ request : Request {
8484 Method : "HEAD" ,
8585 URL : "https://cdn.jsdelivr.net/health" ,
8686 Allowed : true ,
@@ -91,7 +91,7 @@ func TestLoggingAuditor(t *testing.T) {
9191 },
9292 {
9393 name : "deny OPTIONS request" ,
94- request : & Request {
94+ request : Request {
9595 Method : "OPTIONS" ,
9696 URL : "https://restricted.api.com/cors" ,
9797 Allowed : false ,
@@ -101,7 +101,7 @@ func TestLoggingAuditor(t *testing.T) {
101101 },
102102 {
103103 name : "allow with port number" ,
104- request : & Request {
104+ request : Request {
105105 Method : "GET" ,
106106 URL : "https://localhost:3000/api/health" ,
107107 Allowed : true ,
@@ -112,7 +112,7 @@ func TestLoggingAuditor(t *testing.T) {
112112 },
113113 {
114114 name : "deny DELETE request" ,
115- request : & Request {
115+ request : Request {
116116 Method : "DELETE" ,
117117 URL : "https://api.production.com/users/admin" ,
118118 Allowed : false ,
@@ -153,13 +153,13 @@ func TestLoggingAuditor(t *testing.T) {
153153func TestLoggingAuditor_EdgeCases (t * testing.T ) {
154154 tests := []struct {
155155 name string
156- request * Request
156+ request Request
157157 expectedLevel string
158158 expectedFields []string
159159 }{
160160 {
161161 name : "empty fields" ,
162- request : & Request {
162+ request : Request {
163163 Method : "" ,
164164 URL : "" ,
165165 Allowed : true ,
@@ -170,7 +170,7 @@ func TestLoggingAuditor_EdgeCases(t *testing.T) {
170170 },
171171 {
172172 name : "special characters in URL" ,
173- request : & Request {
173+ request : Request {
174174 Method : "POST" ,
175175 URL : "https://api.example.com/users?name=John%20Doe&id=123" ,
176176 Allowed : true ,
@@ -181,7 +181,7 @@ func TestLoggingAuditor_EdgeCases(t *testing.T) {
181181 },
182182 {
183183 name : "very long URL" ,
184- request : & Request {
184+ request : Request {
185185 Method : "GET" ,
186186 URL : "https://example.com/" + strings .Repeat ("a" , 1000 ),
187187 Allowed : false ,
@@ -191,7 +191,7 @@ func TestLoggingAuditor_EdgeCases(t *testing.T) {
191191 },
192192 {
193193 name : "deny with custom URL" ,
194- request : & Request {
194+ request : Request {
195195 Method : "DELETE" ,
196196 URL : "https://malicious.com" ,
197197 Allowed : false ,
@@ -233,13 +233,13 @@ func TestLoggingAuditor_DifferentLogLevels(t *testing.T) {
233233 tests := []struct {
234234 name string
235235 logLevel slog.Level
236- request * Request
236+ request Request
237237 expectOutput bool
238238 }{
239239 {
240240 name : "info level allows info logs" ,
241241 logLevel : slog .LevelInfo ,
242- request : & Request {
242+ request : Request {
243243 Method : "GET" ,
244244 URL : "https://github.com" ,
245245 Allowed : true ,
@@ -250,7 +250,7 @@ func TestLoggingAuditor_DifferentLogLevels(t *testing.T) {
250250 {
251251 name : "warn level blocks info logs" ,
252252 logLevel : slog .LevelWarn ,
253- request : & Request {
253+ request : Request {
254254 Method : "GET" ,
255255 URL : "https://github.com" ,
256256 Allowed : true ,
@@ -261,7 +261,7 @@ func TestLoggingAuditor_DifferentLogLevels(t *testing.T) {
261261 {
262262 name : "warn level allows warn logs" ,
263263 logLevel : slog .LevelWarn ,
264- request : & Request {
264+ request : Request {
265265 Method : "POST" ,
266266 URL : "https://example.com" ,
267267 Allowed : false ,
@@ -271,7 +271,7 @@ func TestLoggingAuditor_DifferentLogLevels(t *testing.T) {
271271 {
272272 name : "error level blocks warn logs" ,
273273 logLevel : slog .LevelError ,
274- request : & Request {
274+ request : Request {
275275 Method : "POST" ,
276276 URL : "https://example.com" ,
277277 Allowed : false ,
@@ -312,7 +312,7 @@ func TestLoggingAuditor_NilLogger(t *testing.T) {
312312 }()
313313
314314 auditor := & LoggingAuditor {logger : nil }
315- req := & Request {
315+ req := Request {
316316 Method : "GET" ,
317317 URL : "https://example.com" ,
318318 Allowed : true ,
@@ -331,7 +331,7 @@ func TestLoggingAuditor_JSONHandler(t *testing.T) {
331331 }))
332332
333333 auditor := NewLoggingAuditor (logger )
334- req := & Request {
334+ req := Request {
335335 Method : "GET" ,
336336 URL : "https://github.com" ,
337337 Allowed : true ,
@@ -364,7 +364,7 @@ func TestLoggingAuditor_DiscardHandler(t *testing.T) {
364364 logger := slog .New (slog .NewTextHandler (io .Discard , & slog.HandlerOptions {}))
365365
366366 auditor := NewLoggingAuditor (logger )
367- req := & Request {
367+ req := Request {
368368 Method : "GET" ,
369369 URL : "https://example.com" ,
370370 Allowed : true ,
0 commit comments