Skip to content

Commit 98796b3

Browse files
committed
Fix panic on HTTP requests that fails reaching any provider
1 parent 02bcdff commit 98796b3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/http.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,10 @@ func IncomingHttpHandler(ctx context.Context, endpoint *Endpoint, w http.Respons
156156
res, provider, err := ProxyHTTP(ctx, endpoint, req, timing)
157157

158158
if err != nil {
159-
for _, req := range req.Requests {
160-
metrics.RecordFailedRequest(endpoint.Name, provider.Name, "http", req.Method)
159+
if provider != nil {
160+
for _, req := range req.Requests {
161+
metrics.RecordFailedRequest(endpoint.Name, provider.Name, "http", req.Method)
162+
}
161163
}
162164

163165
if err == ErrNoProvidersAvailable {

0 commit comments

Comments
 (0)