Skip to content

fix: replace bare type assertions in API clients with proper error handling #267

@rubrx

Description

@rubrx

Describe the bug

here both microcks_client.go and keycloak_client.go are unmarshalling into map[string]interface{} and then doing direct type assertions… which can get a bit risky

like configResp["enabled"].(bool) or openIDResp["access_token"].(string) etc (few spots across both files)

if the response shape is off then missing field, wrong type, or even an HTML error page and this will just panic and crash the CLI instead of returning a proper error..
better to switch to typed structs and let json.Unmarshal handle validation, also gets rid of all those assertions.

happy to open a PR if that works!!!!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions