Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
EngHabu committed Apr 13, 2020
1 parent f1e9755 commit 5bc77b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion storage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Config struct {
// If this section is skipped, Caching is disabled
Cache CachingConfig `json:"cache"`
Limits LimitsConfig `json:"limits" pflag:",Sets limits for stores."`
DefaultHttpClientHeaders map[string][]string `json:"defaultHttpClientHeaders" pflag:"-,Sets http headers to set on the default http client."`
DefaultHTTPClientHeaders map[string][]string `json:"defaultHttpClientHeaders" pflag:"-,Sets http headers to set on the default http client."`
}

// Defines connection configurations.
Expand Down
6 changes: 3 additions & 3 deletions storage/rawstores.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func applyDefaultHeaders(r *http.Request, headers map[string][]string) {
}
}

func createHttpClientWithDefaultHeaders(headers map[string][]string) *http.Client {
func createHTTPClientWithDefaultHeaders(headers map[string][]string) *http.Client {
c := &http.Client{}
c.Transport = &proxyTransport{
RoundTripper: http.DefaultTransport,
Expand All @@ -54,13 +54,13 @@ func NewDataStore(cfg *Config, metricsScope promutils.Scope) (s *DataStore, err
// HACK: This sets http headers to the default http client. This is because
// some underlying stores (e.g. S3 Stow Store) grabs the default http client
// and doesn't allow configuration of default headers.
if len(cfg.DefaultHttpClientHeaders) > 0 {
if len(cfg.DefaultHTTPClientHeaders) > 0 {
defaultClient := http.DefaultClient
defer func() {
http.DefaultClient = defaultClient
}()

http.DefaultClient = createHttpClientWithDefaultHeaders(cfg.DefaultHttpClientHeaders)
http.DefaultClient = createHTTPClientWithDefaultHeaders(cfg.DefaultHTTPClientHeaders)
}

var rawStore RawStore
Expand Down
4 changes: 2 additions & 2 deletions storage/rawstores_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func Test_createHttpClientWithDefaultHeaders(t *testing.T) {
t.Run("nil", func(t *testing.T) {
client := createHttpClientWithDefaultHeaders(nil)
client := createHTTPClientWithDefaultHeaders(nil)
assert.NotNil(t, client.Transport)
proxyTransport, casted := client.Transport.(*proxyTransport)
assert.True(t, casted)
Expand All @@ -20,7 +20,7 @@ func Test_createHttpClientWithDefaultHeaders(t *testing.T) {
m := map[string][]string{
"Header1": {"val1", "val2"},
}
client := createHttpClientWithDefaultHeaders(m)
client := createHTTPClientWithDefaultHeaders(m)
assert.NotNil(t, client.Transport)
proxyTransport, casted := client.Transport.(*proxyTransport)
assert.True(t, casted)
Expand Down

0 comments on commit 5bc77b7

Please sign in to comment.