Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
copy resp.Body to *bytes.Buffer
1,045 views
Skip to first unread message
RS
unread,
Oct 7, 2021, 8:13:17 AM
10/7/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
How can I copy resp.Body to a *bytes.Buffer?
I am new to go.
resp.Body is the response which I get from client.Do, and is of type *http.Response
Ross Light
unread,
Oct 7, 2021, 3:55:45 PM
10/7/21
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Use
io.Copy
. Example:
https://play.golang.org/p/89KkmplfZ4M
-Ross
Reply all
Reply to author
Forward
0 new messages