Skip to content

Commit 7fdc7ae

Browse files
committed
💚 linting
1 parent c3cad55 commit 7fdc7ae

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

utils/http/headers/headers.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (hs Headers) AppendHeader(key, value string) {
171171
}
172172

173173
func (hs Headers) Append(h *Header) {
174-
hs[headers.Normalize(h.Key)] = *h
174+
hs[headers.Normalize(h.Key)] = *h //nolint:misspell
175175
}
176176

177177
func (hs Headers) Get(key string) string {
@@ -182,7 +182,7 @@ func (hs Headers) Get(key string) string {
182182
func (hs Headers) get(key string) (found bool, value string) {
183183
h, found := hs[key]
184184
if !found {
185-
h, found = hs[headers.Normalize(key)]
185+
h, found = hs[headers.Normalize(key)] //nolint:misspell
186186
if !found {
187187
return
188188
}
@@ -207,10 +207,10 @@ func (hs Headers) FromRequest(r *http.Request) {
207207
if r == nil {
208208
return
209209
}
210-
hs.FromGoHttpHeaders(&r.Header)
210+
hs.FromGoHTTPHeaders(&r.Header)
211211
}
212212

213-
func (hs Headers) FromGoHttpHeaders(headers *http.Header) {
213+
func (hs Headers) FromGoHTTPHeaders(headers *http.Header) {
214214
if reflection.IsEmpty(headers) {
215215
return
216216
}
@@ -223,7 +223,7 @@ func (hs Headers) FromResponse(resp *http.Response) {
223223
if resp == nil {
224224
return
225225
}
226-
hs.FromGoHttpHeaders(&resp.Header)
226+
hs.FromGoHTTPHeaders(&resp.Header)
227227
}
228228

229229
func (hs Headers) Empty() bool {
@@ -248,7 +248,7 @@ func (hs Headers) AppendToRequest(r *http.Request) {
248248

249249
func (hs Headers) RemoveHeader(key string) {
250250
delete(hs, key)
251-
delete(hs, headers.Normalize(key))
251+
delete(hs, headers.Normalize(key)) //nolint:misspell
252252
}
253253

254254
func (hs Headers) RemoveHeaders(key ...string) {
@@ -283,10 +283,10 @@ func (hs Headers) AllowList(key ...string) *Headers {
283283
// It is possible to provide an allowed list of extra headers which would also be retained.
284284
func (hs Headers) Sanitise(allowList ...string) {
285285
allowedHeaders := mapset.NewSet[string](NormalisedSafeHeaders...)
286-
allowedHeaders.Append(collection.Map[string, string](allowList, headers.Normalize)...)
286+
allowedHeaders.Append(collection.Map[string, string](allowList, headers.Normalize)...) //nolint:misspell
287287
var headersToRemove []string
288288
for key := range hs {
289-
if !allowedHeaders.Contains(headers.Normalize(key)) {
289+
if !allowedHeaders.Contains(headers.Normalize(key)) { //nolint:misspell
290290
headersToRemove = append(headersToRemove, key)
291291
}
292292
}
@@ -518,7 +518,7 @@ func CreateLinkHeader(link, relation, contentType string) string {
518518
// SanitiseHeaders sanitises a collection of request headers not to include any with personal data
519519
func SanitiseHeaders(requestHeader *http.Header) *Headers {
520520
hs := NewHeaders()
521-
hs.FromGoHttpHeaders(requestHeader)
521+
hs.FromGoHTTPHeaders(requestHeader)
522522
hs.Sanitise()
523523
return hs
524524
}

utils/http/headers/headers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ func TestGetHeaders(t *testing.T) {
201201
header := NewHeaders()
202202
test := faker.Word()
203203
header.AppendHeader(HeaderWebsocketProtocol, test)
204-
assert.Equal(t, test, header.Get(headers.Normalize(HeaderWebsocketProtocol)))
204+
assert.Equal(t, test, header.Get(headers.Normalize(HeaderWebsocketProtocol))) //nolint:misspell
205205
assert.True(t, header.HasHeader(HeaderWebsocketProtocol))
206-
assert.True(t, header.HasHeader(headers.Normalize(HeaderWebsocketProtocol)))
206+
assert.True(t, header.HasHeader(headers.Normalize(HeaderWebsocketProtocol))) //nolint:misspell
207207
assert.Empty(t, header.Get(headers.ContentLocation))
208208
assert.False(t, header.HasHeader(headers.ContentLocation))
209-
assert.False(t, header.HasHeader(headers.Normalize(headers.ContentLocation)))
209+
assert.False(t, header.HasHeader(headers.Normalize(headers.ContentLocation))) //nolint:misspell
210210
}
211211

212212
func TestSanitiseHeaders(t *testing.T) {

0 commit comments

Comments
 (0)