From de5f6086d067034c938c272f70d11fd90cfe4fc5 Mon Sep 17 00:00:00 2001 From: Chaim Lev Ari Date: Fri, 18 Jan 2019 11:51:41 +0200 Subject: [PATCH] refactor(oauth): return parse content error --- api/oauth/oauth.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/oauth/oauth.go b/api/oauth/oauth.go index c716ef90a..12d0d440c 100644 --- a/api/oauth/oauth.go +++ b/api/oauth/oauth.go @@ -56,7 +56,11 @@ func (*Service) GetUsername(token string, settings *portainer.OAuthSettings) (st } } - content, _, _ := mime.ParseMediaType(resp.Header.Get("Content-Type")) + content, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) + if err != nil { + return "", err + } + if content == "application/x-www-form-urlencoded" || content == "text/plain" { values, err := url.ParseQuery(string(body)) if err != nil {