return http response directly

This commit is contained in:
Chris Lu
2020-09-09 03:53:09 -07:00
parent 5e13bc878c
commit 4fc0bd1a81
5 changed files with 20 additions and 19 deletions

View File

@@ -174,7 +174,7 @@ func GetUrlStream(url string, values url.Values, readFn func(io.Reader) error) e
return readFn(r.Body)
}
func DownloadFile(fileUrl string) (filename string, header http.Header, rc io.ReadCloser, e error) {
func DownloadFile(fileUrl string) (filename string, header http.Header, resp *http.Response, e error) {
response, err := client.Get(fileUrl)
if err != nil {
return "", nil, nil, err
@@ -188,7 +188,7 @@ func DownloadFile(fileUrl string) (filename string, header http.Header, rc io.Re
filename = strings.Trim(filename, "\"")
}
}
rc = response.Body
resp = response
return
}