3
0

Prevent context-canceled errors from logging

This commit is contained in:
Denis Arh
2021-10-04 07:31:43 +02:00
parent 122be08b6a
commit 65144c7b26

View File

@@ -167,7 +167,18 @@ func (h AuthHandlers) oauth2Token(req *request.AuthReq) (err error) {
func (h AuthHandlers) oauth2Info(w http.ResponseWriter, r *http.Request) {
ti, err := h.OAuth2.ValidationBearerToken(r)
if err != nil {
if errors.Is(err, context.Canceled) {
// Gracefully handle request cancellation
//
// This happens during the login procedure when browser is
// sent through a couple of quick redirects that can
// terminate requests
w.WriteHeader(http.StatusNoContent)
return
}
var (
data = make(map[string]interface{})
code int