req icon indicating copy to clipboard operation
req copied to clipboard

Tutorial ToBytes() wrong example

Open kostas-petrakis opened this issue 7 months ago • 1 comments

There is a small mistake in the Get Response body in the documentation.

More specific the example for the ToBytes() is:

body, err := resp.ToString()
if err != nil {
    log.Fatal(err)
}
fmt.Println("body:", body)

I think should be:

resp, err := client.R().Get(url)
if err != nil {
    log.Fatal(err)
}
body, err := resp.ToBytes()
if err != nil {
    log.Fatal(err)
}
fmt.Println("body:", string(body))

kostas-petrakis avatar Jul 25 '24 15:07 kostas-petrakis