mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
[bob] Log body of "Bad Request" responses (#19823)
This commit is contained in:
parent
87fa7d0fcd
commit
43a156630f
@ -7,6 +7,7 @@ package proxy
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -229,7 +230,12 @@ func (proxy *Proxy) reverse(alias string) *httputil.ReverseProxy {
|
|||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
if resp.StatusCode == http.StatusBadRequest {
|
if resp.StatusCode == http.StatusBadRequest {
|
||||||
log.WithField("URL", resp.Request.URL.String()).Warn("bad request")
|
bodyBytes, err := io.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).WithField("URL", resp.Request.URL.String()).Warn("failed to read response body")
|
||||||
|
}
|
||||||
|
|
||||||
|
log.WithField("URL", resp.Request.URL.String()).WithField("Body", string(bodyBytes)).Warn("bad request")
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user