Skip to content

Query arguments need to be escaped #66

@gdbarron

Description

@gdbarron

I am attempting to delete a file and this is failing due to the slash in the file location.

d := map[string]string{
	"filelocation": "nsconfig/ssl",
}
err = adc.DeleteResourceWithArgsMap(service.Systemfile.Type(), myfilename, d)

This returns a 400,

GET /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig/ssl HTTP/1.1" 400 111 "-" "Go-http-client/1.1

As it doesn't find the item it doesn't try to delete.

The fix was to escape the string and ensure / is changed to %2F.

d := map[string]string{
	"filelocation": url.PathEscape("nsconfig/ssl"),
}
err = adc.DeleteResourceWithArgsMap(service.Systemfile.Type(), myfilename, d)
GET /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig%2Fssl HTTP/1.1" 200 221 "-" "Go-http-client/1.1
DELETE /nitro/v1/config/systemfile/myfilename?args=filelocation:nsconfig%2Fssl HTTP/1.1" 200 57 "-" "Go-http-client/1.1"

I'm assuming this will be the same issue for all query parameters and not specific to my use case.

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