Skip to content

Deleting a non-empty Workspace fails with bad error message #461

@mchlumsky

Description

@mchlumsky

When deleting a workspace that is not empty, the response returned is a 400 and the message in the response isn't parsed correctly.

Example: the body of the response is:
{"message":{"message":"Workspace is not empty","entities":{"plugins":224,"services":2,"routes":60,"audit_requests":1}}}

Expected:

workspaceService.Delete(ctx, &workspaceName) should return an error explaining the Workspace is not empty

Actual:
workspaceService.Delete(ctx, &workspaceName) returns an error that looks like this:

HTTP status 400 (message: \"<failed to parse response body: json: cannot unmarshal object into Go struct field .Message of type string>\")

Using github.com/kong/go-kong v0.55.0 with Kong Enterprise version 3.0.2.0

Extra information: I'm pretty sure the problem comes from here. The struct doesn't match the response body.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions