Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/20250814161616.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[headers] Add method to get the value of a specific header
8 changes: 8 additions & 0 deletions utils/http/headers/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ func (hs Headers) Append(h *Header) {
hs[h.Key] = *h
}

func (hs Headers) Get(key string) string {
h, found := hs[key]
if !found {
return ""
}
return h.Value
}

func (hs Headers) Has(h *Header) bool {
if h == nil {
return false
Expand Down
1 change: 1 addition & 0 deletions utils/http/headers/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "net/http"
type IHTTPHeaders interface {
AppendHeader(key, value string)
Append(h *Header)
Get(key string) string
Has(h *Header) bool
HasHeader(key string) bool
Empty() bool
Expand Down
Loading
Loading