Skip to content

Commit

Permalink
fix: send 502 when no indexer candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Sep 4, 2023
1 parent 1129833 commit 224f735
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/server/http/ipfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func IpfsHandler(fetcher types.Fetcher, cfg HttpServerConfig) func(http.Response
default:
}
if errors.Is(err, retriever.ErrNoCandidates) {
errorResponse(res, statusLogger, http.StatusNotFound, errors.New("no candidates found"))
errorResponse(res, statusLogger, http.StatusBadGateway, errors.New("no candidates found"))
} else {
errorResponse(res, statusLogger, http.StatusGatewayTimeout, fmt.Errorf("failed to fetch CID: %w", err))
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/server/http/ipfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func TestIpfsHandler(t *testing.T) {
fetchFunc: func(ctx context.Context, r types.RetrievalRequest, cb func(types.RetrievalEvent)) (*types.RetrievalStats, error) {
return nil, retriever.ErrNoCandidates
},
wantStatus: http.StatusNotFound,
wantStatus: http.StatusBadGateway,
wantBody: "no candidates found\n",
},
{
Expand Down

0 comments on commit 224f735

Please sign in to comment.