Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pkg/reporting/trackers/linear/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,17 @@ type Options struct {

// New creates a new issue tracker integration client based on options.
func New(options *Options) (*Integration, error) {
var transport http.RoundTripper = http.DefaultTransport
if options.HttpClient != nil && options.HttpClient.HTTPClient.Transport != nil {
transport = options.HttpClient.HTTPClient.Transport
}

httpClient := &http.Client{
Transport: &addHeaderTransport{
T: http.DefaultTransport,
T: transport,
Key: options.APIKey,
},
}
if options.HttpClient != nil {
httpClient.Transport = options.HttpClient.HTTPClient.Transport
}

integration := &Integration{
url: "https://api.linear.app/graphql",
Expand Down Expand Up @@ -385,8 +387,8 @@ func (i *Integration) doGraphqlRequest(ctx context.Context, query string, v any,
return err
}
defer func() {
_ = resp.Body.Close()
}()
_ = resp.Body.Close()
}()
if resp.StatusCode != http.StatusOK {
body, _ := io.ReadAll(resp.Body)
return fmt.Errorf("non-200 OK status code: %v body: %q", resp.Status, body)
Expand Down
Loading