mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
[Backport release-1.5] Fix: failed to assign the default role for the users who log in from dex (#4504)
* Fix: failed to assign the default role for the users who log in from dex Signed-off-by: barnettZQG <barnett.zqg@gmail.com> (cherry picked from commitad501b4582) * Fix: cluster e2e test case Signed-off-by: barnettZQG <barnett.zqg@gmail.com> (cherry picked from commit23cd84ba94) * Fix: the ensure namespace error is ignored Signed-off-by: barnettZQG <barnett.zqg@gmail.com> (cherry picked from commit8beb1c6925) Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
This commit is contained in:
co-authored by
barnettZQG
parent
fafa18e8db
commit
db21d74a52
@@ -206,23 +206,23 @@ func delete(path string) *http.Response {
|
||||
}
|
||||
|
||||
func decodeResponseBody(resp *http.Response, dst interface{}) error {
|
||||
if resp.StatusCode != 200 {
|
||||
return fmt.Errorf("response code is not 200: %d", resp.StatusCode)
|
||||
}
|
||||
if resp.Body == nil {
|
||||
return fmt.Errorf("response body is nil")
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if dst != nil {
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = json.Unmarshal(body, dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
return fmt.Errorf("response code is not 200: %d body: %s", resp.StatusCode, string(body))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user