mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-12 16:44:43 +00:00
Remove redundant length check:
The range body will not execute if the len of r.Parameter.SignaturePayloadHeaders is 0. Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
This commit is contained in:
parent
bd28fd0957
commit
753d12e479
1 changed files with 5 additions and 7 deletions
|
@ -951,13 +951,11 @@ func (r MatchRule) Evaluate(req *Request) (bool, error) {
|
|||
|
||||
// signaturePayload will concatenate the request body with header values from headers specified in r.Parameter.SignaturePayloadHeaders.
|
||||
func (r MatchRule) signaturePayload(body []byte, headers map[string]interface{}) []byte {
|
||||
if len(r.Parameter.SignaturePayloadHeaders) > 0 {
|
||||
for _, elem := range r.Parameter.SignaturePayloadHeaders {
|
||||
h, found := headers[elem]
|
||||
header := fmt.Sprintf("%s", h)
|
||||
if found && header != "" {
|
||||
body = append(body, []byte(header)...)
|
||||
}
|
||||
for _, elem := range r.Parameter.SignaturePayloadHeaders {
|
||||
h, found := headers[elem]
|
||||
header := fmt.Sprintf("%s", h)
|
||||
if found && header != "" {
|
||||
body = append(body, []byte(header)...)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue