mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-13 00:54:53 +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.
|
// 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 {
|
func (r MatchRule) signaturePayload(body []byte, headers map[string]interface{}) []byte {
|
||||||
if len(r.Parameter.SignaturePayloadHeaders) > 0 {
|
for _, elem := range r.Parameter.SignaturePayloadHeaders {
|
||||||
for _, elem := range r.Parameter.SignaturePayloadHeaders {
|
h, found := headers[elem]
|
||||||
h, found := headers[elem]
|
header := fmt.Sprintf("%s", h)
|
||||||
header := fmt.Sprintf("%s", h)
|
if found && header != "" {
|
||||||
if found && header != "" {
|
body = append(body, []byte(header)...)
|
||||||
body = append(body, []byte(header)...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue