mirror of
https://github.com/adnanh/webhook.git
synced 2025-07-04 18:28:31 +00:00
Merge branch 'development' into feature/context-provider-command
This commit is contained in:
commit
d4dacd6f8e
8 changed files with 265 additions and 75 deletions
|
@ -17,9 +17,7 @@ import (
|
|||
"log"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"net/url"
|
||||
"os"
|
||||
"reflect"
|
||||
"regexp"
|
||||
|
@ -50,33 +48,6 @@ const (
|
|||
EnvNamespace string = "HOOK_"
|
||||
)
|
||||
|
||||
// Request represents a webhook request.
|
||||
type Request struct {
|
||||
// The request ID set by the RequestID middleware.
|
||||
ID string
|
||||
|
||||
// The Content-Type of the request.
|
||||
ContentType string
|
||||
|
||||
// The raw request body.
|
||||
Body []byte
|
||||
|
||||
// Headers is a map of the parsed headers.
|
||||
Headers map[string]interface{}
|
||||
|
||||
// Query is a map of the parsed URL query values.
|
||||
Query map[string]interface{}
|
||||
|
||||
// Payload is a map of the parsed payload.
|
||||
Payload map[string]interface{}
|
||||
|
||||
// Context is a map of the parsed pre-hook command result
|
||||
Context map[string]interface{}
|
||||
|
||||
// The underlying HTTP request.
|
||||
RawRequest *http.Request
|
||||
}
|
||||
|
||||
// ParameterNodeError describes an error walking a parameter node.
|
||||
type ParameterNodeError struct {
|
||||
key string
|
||||
|
@ -870,7 +841,9 @@ func (r OrRule) Evaluate(req *Request) (bool, error) {
|
|||
for _, v := range r {
|
||||
rv, err := v.Evaluate(req)
|
||||
if err != nil {
|
||||
return false, err
|
||||
if !IsParameterNodeError(err) {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
|
||||
res = res || rv
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue