Closed thanhtinhpas1 closed 1 year ago
Relative to MR 1993 in Casdoor, currently the API can response error if facing problems. But we still do not check this right now, it can lead to a panic, this MR will cover this part.
Testing code:
func main() { casdoorsdk.InitConfig( "http://localhost:8000", "37fcf22637d98fc2c99e", "a272de88b58f360c06affc6cec5a68e048b5514f", "cert-built-in", "built-in", "app-built-in"); permissions, err := casdoorsdk.GetPermissions(); if err != nil { fmt.Println(err.Error()) } else { for _, permission := range permissions { fmt.Printf("%v\n", permission.Name) } } permissions, _, err = casdoorsdk.GetPaginationPermissions(0, 10, make(map[string]string, 0)); if err != nil { fmt.Println(err.Error()) } else { for _, permission := range permissions { fmt.Printf("%v\n", permission.Name) } } }
When response body Response with status == error:
status == error
this is test error this is test error
When response array permissions:
built-in-permission built-in-permission
@seriouszyx @ComradeProgrammer @Resulte please review
:tada: This PR is included in version 0.24.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Relative to MR 1993 in Casdoor, currently the API can response error if facing problems. But we still do not check this right now, it can lead to a panic, this MR will cover this part.
Testing code:
When response body Response with
status == error
:When response array permissions: