fetchMetricsReport performs a GET against the provided download URL and returns the raw http.Response. The caller is responsible for closing the body.
(ctx context.Context, url string)
| 1140 | // fetchMetricsReport performs a GET against the provided download URL and returns the raw |
| 1141 | // http.Response. The caller is responsible for closing the body. |
| 1142 | func (s *CopilotService) fetchMetricsReport(ctx context.Context, url string) (*http.Response, *Response, error) { |
| 1143 | req, err := http.NewRequestWithContext(ctx, "GET", url, nil) |
| 1144 | if err != nil { |
| 1145 | return nil, nil, err |
| 1146 | } |
| 1147 | |
| 1148 | resp, err := s.client.client.Do(req) |
| 1149 | if err != nil { |
| 1150 | return nil, nil, err |
| 1151 | } |
| 1152 | |
| 1153 | if err := CheckResponse(resp); err != nil { |
| 1154 | resp.Body.Close() |
| 1155 | return nil, newResponse(resp), err |
| 1156 | } |
| 1157 | |
| 1158 | return resp, newResponse(resp), nil |
| 1159 | } |
| 1160 | |
| 1161 | // decodeNDJSONMetrics streams a newline-delimited JSON response body into a slice of *T, |
| 1162 | // returning a nil slice when the body is empty. |
no test coverage detected