@@ -47,9 +47,9 @@ func HandleGet(url string) (*http.Response, error) {
4747 return resp , nil
4848}
4949
50- func HandleRequest (url , method string , timeout int ) (int , []byte , error ) {
50+ func HandleRequest (url , method string , timeout int , options ... RequestOption ) (int , []byte , error ) {
5151 transport := xpack .MultiNodeProvider .LoadRequestTransport ()
52- client := newExternalHTTPClient (transport , time .Duration (timeout )* time .Second )
52+ client := newExternalHTTPClient (transport , time .Duration (timeout )* time .Second , options ... )
5353 defer client .CloseIdleConnections ()
5454 return HandleRequestWithClient (client , url , method , timeout )
5555}
@@ -125,15 +125,15 @@ func HandleRequestWithHeaders(client *http.Client, url, method string, timeout i
125125 }, nil
126126}
127127
128- func RequestFile (url , method string , timeout int ) (io.ReadCloser , context.CancelFunc , error ) {
128+ func RequestFile (url , method string , timeout int , options ... RequestOption ) (io.ReadCloser , context.CancelFunc , error ) {
129129 defer func () {
130130 if r := recover (); r != nil {
131131 global .LOG .Errorf ("handle request failed, error message: %v" , r )
132132 return
133133 }
134134 }()
135135 transport := xpack .MultiNodeProvider .LoadRequestTransport ()
136- client := newExternalHTTPClient (transport , time .Duration (timeout )* time .Second )
136+ client := newExternalHTTPClient (transport , time .Duration (timeout )* time .Second , options ... )
137137 defer client .CloseIdleConnections ()
138138 ctx , cancel := context .WithTimeout (context .Background (), time .Duration (timeout )* time .Second )
139139 request , err := http .NewRequestWithContext (ctx , method , url , nil )
0 commit comments