@@ -6,11 +6,13 @@ import (
66 "errors"
77 "fmt"
88 "net/http"
9+ "strings"
10+
911 "pinata/internal/common"
1012 "pinata/internal/config"
1113 "pinata/internal/gateways"
14+ "pinata/internal/httpclient"
1215 "pinata/internal/types"
13- "strings"
1416)
1517
1618func DeleteFile (id string , network string ) error {
@@ -32,7 +34,7 @@ func DeleteFile(id string, network string) error {
3234 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
3335 req .Header .Set ("content-type" , "application/json" )
3436
35- client := & http .Client {}
37+ client := httpclient .Client
3638 resp , err := client .Do (req )
3739 if err != nil {
3840 return errors .Join (err , errors .New ("failed to send the request" ))
@@ -69,7 +71,7 @@ func GetFile(id string, network string) (types.GetFileResponse, error) {
6971 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
7072 req .Header .Set ("content-type" , "application/json" )
7173
72- client := & http .Client {}
74+ client := httpclient .Client
7375 resp , err := client .Do (req )
7476 if err != nil {
7577 return types.GetFileResponse {}, errors .Join (err , errors .New ("failed to send the request" ))
@@ -125,7 +127,7 @@ func UpdateFile(id string, name string, network string) (types.GetFileResponse,
125127 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
126128 req .Header .Set ("content-type" , "application/json" )
127129
128- client := & http .Client {}
130+ client := httpclient .Client
129131 resp , err := client .Do (req )
130132 if err != nil {
131133 return types.GetFileResponse {}, errors .Join (err , errors .New ("failed to send the request" ))
@@ -212,7 +214,7 @@ func ListFiles(amount string, pageToken string, cidPending bool, name string, ci
212214 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
213215 req .Header .Set ("content-type" , "application/json" )
214216
215- client := & http .Client {}
217+ client := httpclient .Client
216218 resp , err := client .Do (req )
217219 if err != nil {
218220 return types.ListResponse {}, errors .Join (err , errors .New ("failed to send the request" ))
@@ -274,7 +276,7 @@ func GetSwapHistory(cid string, domain string, network string) (types.GetSwapHis
274276 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
275277 req .Header .Set ("content-type" , "application/json" )
276278
277- client := & http .Client {}
279+ client := httpclient .Client
278280 resp , err := client .Do (req )
279281 if err != nil {
280282 return types.GetSwapHistoryResponse {}, errors .Join (err , errors .New ("failed to send the request" ))
@@ -332,7 +334,7 @@ func AddSwap(cid string, swapCid string, network string) (types.AddSwapResponse,
332334 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
333335 req .Header .Set ("content-type" , "application/json" )
334336
335- client := & http .Client {}
337+ client := httpclient .Client
336338 resp , err := client .Do (req )
337339 if err != nil {
338340 return types.AddSwapResponse {}, errors .Join (err , errors .New ("failed to send the request" ))
@@ -379,7 +381,7 @@ func RemoveSwap(cid string, network string) error {
379381 req .Header .Set ("Authorization" , "Bearer " + string (jwt ))
380382 req .Header .Set ("content-type" , "application/json" )
381383
382- client := & http .Client {}
384+ client := httpclient .Client
383385 resp , err := client .Do (req )
384386 if err != nil {
385387 return errors .Join (err , errors .New ("failed to send the request" ))
0 commit comments