Created
September 29, 2017 13:40
-
-
Save artemnikitin/d8caa2862c0b7762064f5fec39804f91 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func sendRequest(url string, file *io.Reader, info os.FileInfo) *http.Response { | |
client := &http.Client{ | |
Timeout: 10 * time.Minute, | |
} | |
request, err := http.NewRequest("PUT", url, *file) | |
errors.Validate(err, "Failed to create HTTP request") | |
request.Header.Add("Content-Type", "application/octet-stream") | |
request.ContentLength = info.Size() | |
resp, err := client.Do(request) | |
errors.Validate(err, "Failed to upload file by S3 link") | |
return resp | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment