Files
dependabot[bot]andMajd Alfhaily f3c9076ff0 Bump golang.org/x/net from 0.23.0 to 0.33.0 (#334)
* Bump golang.org/x/net from 0.23.0 to 0.33.0

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.23.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.23.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix linting errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Majd Alfhaily <majd@alfhaily.me>
2025-01-20 00:00:00 +01:00

28 lines
416 B
Go

package http
import (
"errors"
"strings"
)
var (
ErrHeaderNotFound = errors.New("header not found")
)
type Result[R interface{}] struct {
StatusCode int
Headers map[string]string
Data R
}
func (c *Result[R]) GetHeader(key string) (string, error) {
key = strings.ToLower(key)
for k, v := range c.Headers {
if strings.ToLower(k) == key {
return v, nil
}
}
return "", ErrHeaderNotFound
}