Skip to content

Commit 3536377

Browse files
committed
use the client to connect to the API instead of http.DefaultClient so that proxies are used
1 parent 43aa0c4 commit 3536377

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/src/search_jobs_logs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
// fetchJobLogs retrieves logs for a search job from its log URL
15-
func fetchJobLogs(jobID string, logURL string) (io.ReadCloser, error) {
15+
func fetchJobLogs(client api.Client, jobID string, logURL string) (io.ReadCloser, error) {
1616
if logURL == "" {
1717
return nil, fmt.Errorf("no logs URL found for search job %s", jobID)
1818
}
@@ -24,7 +24,7 @@ func fetchJobLogs(jobID string, logURL string) (io.ReadCloser, error) {
2424

2525
req.Header.Add("Authorization", "token "+cfg.AccessToken)
2626

27-
resp, err := http.DefaultClient.Do(req)
27+
resp, err := client.Do(req)
2828
if err != nil {
2929
return nil, err
3030
}
@@ -88,7 +88,7 @@ func init() {
8888
return fmt.Errorf("no job found with ID %s", jobID)
8989
}
9090

91-
logsData, err := fetchJobLogs(jobID, job.LogURL)
91+
logsData, err := fetchJobLogs(client, jobID, job.LogURL)
9292
if err != nil {
9393
return err
9494
}

cmd/src/search_jobs_results.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
)
1313

1414
// fetchJobResults retrieves results for a search job from its results URL
15-
func fetchJobResults(jobID string, resultsURL string) (io.ReadCloser, error) {
15+
func fetchJobResults(client api.Client, jobID string, resultsURL string) (io.ReadCloser, error) {
1616
if resultsURL == "" {
1717
return nil, fmt.Errorf("no results URL found for search job %s", jobID)
1818
}
@@ -24,7 +24,7 @@ func fetchJobResults(jobID string, resultsURL string) (io.ReadCloser, error) {
2424

2525
req.Header.Add("Authorization", "token "+cfg.AccessToken)
2626

27-
resp, err := http.DefaultClient.Do(req)
27+
resp, err := client.Do(req)
2828
if err != nil {
2929
return nil, err
3030
}
@@ -90,7 +90,7 @@ func init() {
9090
return fmt.Errorf("no job found with ID %s", jobID)
9191
}
9292

93-
resultsData, err := fetchJobResults(jobID, job.URL)
93+
resultsData, err := fetchJobResults(client, jobID, job.URL)
9494
if err != nil {
9595
return err
9696
}

0 commit comments

Comments
 (0)