webhook deliver: keep Bearer prefix in history
This commit is contained in:
parent
36f05e6f4e
commit
5d45545ca1
|
@ -78,7 +78,13 @@ func Deliver(ctx context.Context, t *webhook_model.HookTask) error {
|
|||
}
|
||||
if authorization != "" {
|
||||
req.Header.Set("Authorization", authorization)
|
||||
t.RequestInfo.Headers["Authorization"] = "******"
|
||||
redacted := "******"
|
||||
if strings.HasPrefix(authorization, "Bearer ") {
|
||||
redacted = "Bearer " + redacted
|
||||
} else if strings.HasPrefix(authorization, "Basic ") {
|
||||
redacted = "Basic " + redacted
|
||||
}
|
||||
t.RequestInfo.Headers["Authorization"] = redacted
|
||||
}
|
||||
|
||||
t.ResponseInfo = &webhook_model.HookResponse{
|
||||
|
|
|
@ -132,7 +132,7 @@ func TestWebhookDeliverAuthorizationHeader(t *testing.T) {
|
|||
}
|
||||
|
||||
assert.True(t, hookTask.IsSucceed)
|
||||
assert.Equal(t, "******", hookTask.RequestInfo.Headers["Authorization"])
|
||||
assert.Equal(t, "Bearer ******", hookTask.RequestInfo.Headers["Authorization"])
|
||||
}
|
||||
|
||||
func TestWebhookDeliverHookTask(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue