Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial ToBytes() wrong example #375

Open
kostas-petrakis opened this issue Jul 25, 2024 · 1 comment
Open

Tutorial ToBytes() wrong example #375

kostas-petrakis opened this issue Jul 25, 2024 · 1 comment

Comments

@kostas-petrakis
Copy link

kostas-petrakis commented Jul 25, 2024

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))
@imroc
Copy link
Owner

imroc commented Jul 26, 2024

The example shows ToString() or ToBytes(), which uses ToString() for example, and ToBytes() is been omitted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants