Skip to content

Commit 621d707

Browse files
authored
fix: handles case where binary request does not return a response (#251)
1 parent 74a905b commit 621d707

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,12 @@ type binaryResponse struct {
341341
func (c *Client) getBinary(ctx context.Context, config *apiConfig, apiReq apiRequest) (binaryResponse, error) {
342342
requestMetrics := c.metricReporter.NewRequest(config.path)
343343
httpResp, err := c.get(ctx, config, apiReq)
344-
requestMetrics.EndRequest(ctx, err, httpResp, httpResp.Header.Get("x-goog-maps-metro-area"))
345344
if err != nil {
345+
requestMetrics.EndRequest(ctx, err, httpResp, "")
346346
return binaryResponse{}, err
347347
}
348348

349+
requestMetrics.EndRequest(ctx, err, httpResp, httpResp.Header.Get("x-goog-maps-metro-area"))
349350
return binaryResponse{httpResp.StatusCode, httpResp.Header.Get("Content-Type"), httpResp.Body}, nil
350351
}
351352

0 commit comments

Comments
 (0)