mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-23 05:42:30 +00:00
Simplify boolean some comparisons
This commit is contained in:
parent
cfed5cfe4b
commit
48061f1508
2 changed files with 4 additions and 4 deletions
|
@ -687,7 +687,7 @@ func (r AndRule) Evaluate(headers, query, payload *map[string]interface{}, body
|
||||||
}
|
}
|
||||||
|
|
||||||
res = res && rv
|
res = res && rv
|
||||||
if res == false {
|
if !res {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ func (r OrRule) Evaluate(headers, query, payload *map[string]interface{}, body *
|
||||||
}
|
}
|
||||||
|
|
||||||
res = res || rv
|
res = res || rv
|
||||||
if res == true {
|
if res {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ func main() {
|
||||||
|
|
||||||
newHooksFiles := hooksFiles[:0]
|
newHooksFiles := hooksFiles[:0]
|
||||||
for _, filePath := range hooksFiles {
|
for _, filePath := range hooksFiles {
|
||||||
if _, ok := loadedHooksFromFiles[filePath]; ok == true {
|
if _, ok := loadedHooksFromFiles[filePath]; ok {
|
||||||
newHooksFiles = append(newHooksFiles, filePath)
|
newHooksFiles = append(newHooksFiles, filePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,7 @@ func reloadHooks(hooksFilePath string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (matchLoadedHook(hook.ID) != nil && !wasHookIDAlreadyLoaded) || seenHooksIds[hook.ID] == true {
|
if (matchLoadedHook(hook.ID) != nil && !wasHookIDAlreadyLoaded) || seenHooksIds[hook.ID] {
|
||||||
log.Printf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!", hook.ID)
|
log.Printf("error: hook with the id %s has already been loaded!\nplease check your hooks file for duplicate hooks ids!", hook.ID)
|
||||||
log.Println("reverting hooks back to the previous configuration")
|
log.Println("reverting hooks back to the previous configuration")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue