-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add query-frontend option to select request headers in query logs
- Loading branch information
1 parent
9d82759
commit 04ec072
Showing
5 changed files
with
87 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package frontend | ||
|
||
import ( | ||
"net/http" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestFormatRequestHeaders(t *testing.T) { | ||
h := http.Header{} | ||
h.Add("X-Header-To-Log", "i should be logged!") | ||
h.Add("X-Header-To-Not-Log", "i shouldn't be logged!") | ||
|
||
fields := formatRequestHeaders(&h, []string{"X-Header-To-Log", "X-Header-Not-Present"}) | ||
|
||
expected := []interface{}{ | ||
"header_x_header_to_log", | ||
"i should be logged!", | ||
} | ||
|
||
require.Equal(t, expected, fields) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters