File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -48,7 +48,9 @@ func DumpRequest(req *http.Request) {
48
48
temp := req .Header .Get ("Authorization" )
49
49
50
50
if ! UnmaskAPIKey {
51
- req .Header .Set ("Authorization" , "Bearer " + utils .Redact (strings .Split (temp , " " )[1 ]))
51
+ if token := strings .Split (temp , " " )[1 ]; token != "" {
52
+ req .Header .Set ("Authorization" , "Bearer " + utils .Redact (token ))
53
+ }
52
54
}
53
55
54
56
dump , err := httputil .DumpRequest (req , req .ContentLength > 0 )
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ package utils
2
2
3
3
import "strings"
4
4
5
+ /*
6
+ Redact masks the given token by replacing part of the string with *
7
+ */
5
8
func Redact (token string ) string {
6
9
str := token [4 : len (token )- 3 ]
7
10
redaction := strings .Repeat ("*" , len (str ))
You can’t perform that action at this time.
0 commit comments