(ctx context.Context, uploadURL, localPath, contentType string)
| 72 | } |
| 73 | |
| 74 | func UploadFileWithContentType(ctx context.Context, uploadURL, localPath, contentType string) error { |
| 75 | file, err := os.Open(localPath) |
| 76 | if err != nil { |
| 77 | return fmt.Errorf("failed to open file: %w", err) |
| 78 | } |
| 79 | defer file.Close() |
| 80 | |
| 81 | return UploadReaderWithContentType(ctx, uploadURL, file, contentType) |
| 82 | } |
| 83 | |
| 84 | func UploadReaderWithContentType(ctx context.Context, uploadURL string, reader io.Reader, contentType string) error { |
| 85 | req, err := http.NewRequestWithContext(ctx, http.MethodPut, uploadURL, reader) |
no test coverage detected