Skip to content

Commit

Permalink
fix: handles case where binary request does not return a response (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmcintyre authored Nov 19, 2020
1 parent 74a905b commit 621d707
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,12 @@ type binaryResponse struct {
func (c *Client) getBinary(ctx context.Context, config *apiConfig, apiReq apiRequest) (binaryResponse, error) {
requestMetrics := c.metricReporter.NewRequest(config.path)
httpResp, err := c.get(ctx, config, apiReq)
requestMetrics.EndRequest(ctx, err, httpResp, httpResp.Header.Get("x-goog-maps-metro-area"))
if err != nil {
requestMetrics.EndRequest(ctx, err, httpResp, "")
return binaryResponse{}, err
}

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

Expand Down

0 comments on commit 621d707

Please sign in to comment.