req
req copied to clipboard
Tutorial ToBytes() wrong example
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))
The example shows ToString() or ToBytes(), which uses ToString() for example, and ToBytes() is been omitted