mirror of
https://github.com/majd/ipatool
synced 2026-11-26 17:27:52 +08:00
* 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>
28 lines
416 B
Go
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
|
|
}
|