http.NoBody
instead of nil
in http.NewRequest
calls GO-R4001401
402func DownloadTo(url, output string) error {
403
404 req, err := http.NewRequest("GET", url, nil)405
406 if err != nil {
407 return err
169
170func GetOnline(reqData GetOnlineReq, token string) ([]byte, error) {
171 // TODO: add cache
172 req, err := http.NewRequest("GET", ServerHostApi+"/plugin/list?"+reqData.Format(), nil)173
174 if err != nil {
175 logger.Error("get online plugins: ", err)
http.NoBody
is an io.ReadCloser
with no bytes. Read always returns EOF
and
Close
always returns nil
.
func foo(url string) {
http.NewRequest("GET", url, nil)
}
func foo(url string) {
http.NewRequest("GET", url, http.NoBody)
}