feat(routing/http): return 200 for empty results per IPIP-513#1032
Merged
feat(routing/http): return 200 for empty results per IPIP-513#1032
Conversation
return HTTP 200 with empty results instead of 404 when no records found, while maintaining backward compatibility in clients to handle both response codes Fixes: #1024 Spec: ipfs/specs#513
This was referenced Sep 11, 2025
Closed
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #1032 +/- ##
==========================================
+ Coverage 60.51% 60.62% +0.11%
==========================================
Files 268 268
Lines 33399 33460 +61
==========================================
+ Hits 20212 20286 +74
+ Misses 11517 11507 -10
+ Partials 1670 1667 -3
... and 10 files with indirect coverage changes 🚀 New features to boost your workflow:
|
the metric now correctly reports: - 0 for empty results (instead of 1) - n for n results (instead of n+1)
- GetIPNS now records latency, status code, and length (0 or 1) - PutIPNS now records latency and status code - uses consistent pattern with httpReq.Host for host extraction
- document how OpenCensus bucket selection works (value < boundary) - explain mapping to Prometheus le buckets for both latency and length - provide examples of how to extract meaningful data from metrics
- routing_http_client_requests_total: counts all requests including errors - routing_http_client_positive_responses_total: counts requests with 1+ results - avoids confusing histogram bucket math for common queries - documented with simple Grafana query examples
1cff7d9 to
3a70903
Compare
hsanjuan
approved these changes
Sep 11, 2025
gammazero
approved these changes
Sep 12, 2025
ensure http connection can be reused by draining response body before closing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
routing/http: Delegated Routing V1 HTTP endpoints now return 200 with empty results instead of 404 when no records are found, per IPIP-513 (#1024)/routing/v1/providers/{cid},/routing/v1/peers/{peer-id},/routing/v1/ipns/{name}) now return HTTP 200 with empty JSON arrays or appropriate content types for empty resultsTODO
Context