Don't check if path matches if it's not necessary
This commit is contained in:
parent
06466faa87
commit
d5b3eace4a
1 changed files with 5 additions and 3 deletions
|
@ -115,9 +115,11 @@ func customHeadersMiddleware(next http.Handler) http.Handler {
|
||||||
matches = true
|
matches = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fileMatch := configEntry.FileExtension == "*" || reqFileExtension == "."+configEntry.FileExtension
|
matches =
|
||||||
pathMatch := configEntry.Path == "*" || strings.HasPrefix(r.URL.Path, configEntry.Path)
|
// Check if the file extension matches.
|
||||||
matches = fileMatch && pathMatch
|
(configEntry.FileExtension == "*" || reqFileExtension == "."+configEntry.FileExtension) &&
|
||||||
|
// Check if the path matches.
|
||||||
|
(configEntry.Path == "*" || strings.HasPrefix(r.URL.Path, configEntry.Path))
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches {
|
if matches {
|
||||||
|
|
Loading…
Reference in a new issue