Files
QSfera/vendor/github.com/rs/cors/utils.go
T
dependabot[bot]andjkoberg c4bebfdd78 chore(deps): bump github.com/rs/cors from 1.10.1 to 1.11.0
Bumps [github.com/rs/cors](https://github.com/rs/cors) from 1.10.1 to 1.11.0.
- [Commits](https://github.com/rs/cors/compare/v1.10.1...v1.11.0)

---
updated-dependencies:
- dependency-name: github.com/rs/cors
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-18 09:53:10 +02:00

35 lines
639 B
Go

package cors
import (
"net/http"
"strings"
)
type wildcard struct {
prefix string
suffix string
}
func (w wildcard) match(s string) bool {
return len(s) >= len(w.prefix)+len(w.suffix) &&
strings.HasPrefix(s, w.prefix) &&
strings.HasSuffix(s, w.suffix)
}
// convert converts a list of string using the passed converter function
func convert(s []string, f func(string) string) []string {
out := make([]string, len(s))
for i := range s {
out[i] = f(s[i])
}
return out
}
func first(hdrs http.Header, k string) ([]string, bool) {
v, found := hdrs[k]
if !found || len(v) == 0 {
return nil, false
}
return v[:1], true
}