Skip to content

Commit 1562b17

Browse files
authored
Removed redundant log nil checks (#178)
1 parent 3d336ea commit 1562b17

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

cors.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) {
391391
if len(c.maxAge) > 0 {
392392
headers["Access-Control-Max-Age"] = c.maxAge
393393
}
394-
if c.Log != nil {
395-
c.logf(" Preflight response headers: %v", headers)
396-
}
394+
c.logf(" Preflight response headers: %v", headers)
397395
}
398396

399397
// handleActualRequest handles simple cross-origin requests, actual request or redirects
@@ -440,9 +438,7 @@ func (c *Cors) handleActualRequest(w http.ResponseWriter, r *http.Request) {
440438
if c.allowCredentials {
441439
headers["Access-Control-Allow-Credentials"] = headerTrue
442440
}
443-
if c.Log != nil {
444-
c.logf(" Actual response added headers: %v", headers)
445-
}
441+
c.logf(" Actual response added headers: %v", headers)
446442
}
447443

448444
// convenience method. checks if a logger is set.

0 commit comments

Comments
 (0)