mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
prober: log HTTP response body on failure
Signed-off-by: Anton Tolchanov <anton@tailscale.com>
This commit is contained in:
parent
affe11c503
commit
869b34ddeb
@ -53,7 +53,12 @@ func probeHTTP(ctx context.Context, url string, want []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !bytes.Contains(bs, want) {
|
if !bytes.Contains(bs, want) {
|
||||||
return fmt.Errorf("body of %q does not contain %q", url, want)
|
// Log response body, but truncate it if it's too large; the limit
|
||||||
|
// has been chosen arbitrarily.
|
||||||
|
if maxlen := 300; len(bs) > maxlen {
|
||||||
|
bs = bs[:maxlen]
|
||||||
|
}
|
||||||
|
return fmt.Errorf("body of %q does not contain %q (got: %q)", url, want, string(bs))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user