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

你好,目前requests时不支持setBody吗? #8

Open
hanxinhisen opened this issue Aug 10, 2019 · 1 comment
Open

你好,目前requests时不支持setBody吗? #8

hanxinhisen opened this issue Aug 10, 2019 · 1 comment

Comments

@hanxinhisen
Copy link

No description provided.

@zanjie1999
Copy link

不支持,因为会close掉,但你可以这样

request, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Println(err)
}
client := &http.Client{}
response, err := client.Do(request)
if err != nil {
log.Println(err)
}
defer response.Body.Close()
saveFile(response.Body)

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