Skip to content

GET request with body not working (body ignored) #1052

@ch0s1n

Description

@ch0s1n

Hi, I found a possible issue when using Resty with a GET request that contains a body.

According to my use case, I need to send a GET request with a JSON body, but Resty seems to ignore the body entirely.

`func main() {
client := resty.New()

url := "xxxxxxxx"

requestBody := map[string]interface{}{
	"xx":          "xxx",
	"xxx": "xxx",
	"xx":  xxx,
}
josnBody, _ := json.Marshal(requestBody)

resp, err := client.R().
	SetHeader("Authorization", authorizationHeader).
	SetHeader("Accept", "*/*").
	SetBody(josnBody).
	Get(url) //

if err != nil {
	log.Fatal(err)
}

}`

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