refactor(oauth): return parse content error

pull/2749/head
Chaim Lev Ari 2019-01-18 11:51:41 +02:00
parent 46e8f10aea
commit de5f6086d0
1 changed files with 5 additions and 1 deletions

View File

@ -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 {