Skip to content

Commit

Permalink
fix: update allowed header prefix (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
stepansergeevitch authored Nov 13, 2024
1 parent c15073f commit cfa1c8a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func extractAdditionalHeaders(ctx context.Context) map[string]string {
// only take headers that start with Firebolt- prefix
filteredHeaders := make(map[string]string)
for key, value := range additionalHeaders {
if strings.HasPrefix(key, "X-Firebolt-") {
if strings.HasPrefix(key, "Firebolt-") {
filteredHeaders[key] = value
}
}
Expand Down
6 changes: 3 additions & 3 deletions client_common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ func testAdditionalHeaders(t *testing.T, clientFactory func(string) Client) {
// Test that additional headers, passed in ctx are respected

var additionalHeaders = map[string]string{
"X-Firebolt-Test-Header": "test",
"Ignored-Header": "ignored",
"Firebolt-Test-Header": "test",
"Ignored-Header": "ignored",
}
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == ServiceAccountLoginURLSuffix {
_, _ = w.Write(getAuthResponse(10000))
} else if r.URL.Path == UsernamePasswordURLSuffix {
_, _ = w.Write(getAuthResponseV0(10000))
} else {
if r.Header.Get("X-Firebolt-Test-Header") != "test" {
if r.Header.Get("Firebolt-Test-Header") != "test" {
t.Errorf("Did not set Firebolt-Test-Header value when passed in ctx")
}
if r.Header.Get("Ignored-Header") != "" {
Expand Down
2 changes: 1 addition & 1 deletion client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestQuerySetStatements(t *testing.T) {
context.TODO(),
engineUrlMock,
query,
map[string]string{"time_zone": "America/New_York", "database": databaseMock},
map[string]string{"timezone": "America/New_York", "database": databaseMock},
connectionControl{},
)
if err != nil {
Expand Down

0 comments on commit cfa1c8a

Please sign in to comment.