33package imagekit_test
44
55import (
6- "bytes"
76 "context"
87 "fmt"
9- "io"
108 "net/http"
119 "reflect"
1210 "testing"
@@ -42,7 +40,7 @@ func TestUserAgentHeader(t *testing.T) {
4240 }),
4341 )
4442 client .Files .Upload (context .Background (), imagekit.FileUploadParams {
45- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
43+ File : "https://www.example.com/public-url.jpg" ,
4644 FileName : "file-name.jpg" ,
4745 })
4846 if userAgent != fmt .Sprintf ("ImageKit/Go %s" , internal .PackageVersion ) {
@@ -70,7 +68,7 @@ func TestRetryAfter(t *testing.T) {
7068 }),
7169 )
7270 _ , err := client .Files .Upload (context .Background (), imagekit.FileUploadParams {
73- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
71+ File : "https://www.example.com/public-url.jpg" ,
7472 FileName : "file-name.jpg" ,
7573 })
7674 if err == nil {
@@ -109,7 +107,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
109107 option .WithHeaderDel ("X-Stainless-Retry-Count" ),
110108 )
111109 _ , err := client .Files .Upload (context .Background (), imagekit.FileUploadParams {
112- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
110+ File : "https://www.example.com/public-url.jpg" ,
113111 FileName : "file-name.jpg" ,
114112 })
115113 if err == nil {
@@ -143,7 +141,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
143141 option .WithHeader ("X-Stainless-Retry-Count" , "42" ),
144142 )
145143 _ , err := client .Files .Upload (context .Background (), imagekit.FileUploadParams {
146- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
144+ File : "https://www.example.com/public-url.jpg" ,
147145 FileName : "file-name.jpg" ,
148146 })
149147 if err == nil {
@@ -176,7 +174,7 @@ func TestRetryAfterMs(t *testing.T) {
176174 }),
177175 )
178176 _ , err := client .Files .Upload (context .Background (), imagekit.FileUploadParams {
179- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
177+ File : "https://www.example.com/public-url.jpg" ,
180178 FileName : "file-name.jpg" ,
181179 })
182180 if err == nil {
@@ -203,7 +201,7 @@ func TestContextCancel(t *testing.T) {
203201 cancelCtx , cancel := context .WithCancel (context .Background ())
204202 cancel ()
205203 _ , err := client .Files .Upload (cancelCtx , imagekit.FileUploadParams {
206- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
204+ File : "https://www.example.com/public-url.jpg" ,
207205 FileName : "file-name.jpg" ,
208206 })
209207 if err == nil {
@@ -227,7 +225,7 @@ func TestContextCancelDelay(t *testing.T) {
227225 cancelCtx , cancel := context .WithTimeout (context .Background (), 2 * time .Millisecond )
228226 defer cancel ()
229227 _ , err := client .Files .Upload (cancelCtx , imagekit.FileUploadParams {
230- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
228+ File : "https://www.example.com/public-url.jpg" ,
231229 FileName : "file-name.jpg" ,
232230 })
233231 if err == nil {
@@ -257,7 +255,7 @@ func TestContextDeadline(t *testing.T) {
257255 }),
258256 )
259257 _ , err := client .Files .Upload (deadlineCtx , imagekit.FileUploadParams {
260- File : io . Reader ( bytes . NewBuffer ([] byte ( "https://www.example.com/public-url.jpg" ))) ,
258+ File : "https://www.example.com/public-url.jpg" ,
261259 FileName : "file-name.jpg" ,
262260 })
263261 if err == nil {
0 commit comments