mirror of
https://github.com/TwiN/gatus.git
synced 2025-02-16 18:21:07 +01:00
Trim result body as well
This commit is contained in:
parent
b05ae1c2d2
commit
60e30da7e5
@ -18,6 +18,7 @@ const (
|
|||||||
|
|
||||||
func sanitizeAndResolve(list []string, result *Result) []string {
|
func sanitizeAndResolve(list []string, result *Result) []string {
|
||||||
var sanitizedList []string
|
var sanitizedList []string
|
||||||
|
body := strings.TrimSpace(string(result.Body))
|
||||||
for _, element := range list {
|
for _, element := range list {
|
||||||
element = strings.TrimSpace(element)
|
element = strings.TrimSpace(element)
|
||||||
switch strings.ToUpper(element) {
|
switch strings.ToUpper(element) {
|
||||||
@ -28,7 +29,7 @@ func sanitizeAndResolve(list []string, result *Result) []string {
|
|||||||
case ResponseTimePlaceHolder:
|
case ResponseTimePlaceHolder:
|
||||||
element = strconv.Itoa(int(result.Duration.Milliseconds()))
|
element = strconv.Itoa(int(result.Duration.Milliseconds()))
|
||||||
case BodyPlaceHolder:
|
case BodyPlaceHolder:
|
||||||
element = string(result.Body)
|
element = body
|
||||||
default:
|
default:
|
||||||
// if starts with BodyPlaceHolder, then evaluate json path
|
// if starts with BodyPlaceHolder, then evaluate json path
|
||||||
if strings.HasPrefix(element, BodyPlaceHolder) {
|
if strings.HasPrefix(element, BodyPlaceHolder) {
|
||||||
|
Loading…
Reference in New Issue
Block a user