Skip to content

Commit

Permalink
Removed redundant log nil checks (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
larserka committed May 15, 2024
1 parent 3d336ea commit 1562b17
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions cors.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,7 @@ func (c *Cors) handlePreflight(w http.ResponseWriter, r *http.Request) {
if len(c.maxAge) > 0 {
headers["Access-Control-Max-Age"] = c.maxAge
}
if c.Log != nil {
c.logf(" Preflight response headers: %v", headers)
}
c.logf(" Preflight response headers: %v", headers)
}

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

// convenience method. checks if a logger is set.
Expand Down

0 comments on commit 1562b17

Please sign in to comment.