From f88c3b8abec5c7017134107a2c8fe32305dc7d72 Mon Sep 17 00:00:00 2001 From: Anik Bhattacharjee Date: Thu, 6 Feb 2025 13:48:04 -0500 Subject: [PATCH] (catalogd) `serveJSON` lines instead of `http.serverContent` for no-params The metas endpoint was using `serverJSONLines` for serving queries that are parameterized, which copies content from a reader to the response writer under the hood. As a result no-parameterized query responses don't have range request support. The endpoint was however using `http.ServeContent` for cases when no parameters were provided, which does have range request support. This PR switches the `http.ServeContent` out for `serveJSONLines` to make sure metas endpoint is consistent in it's lack of support for range requests. Signed-off-by: Anik Bhattacharjee --- catalogd/internal/storage/localdir.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/catalogd/internal/storage/localdir.go b/catalogd/internal/storage/localdir.go index 87558a6ba..08b7e296e 100644 --- a/catalogd/internal/storage/localdir.go +++ b/catalogd/internal/storage/localdir.go @@ -243,8 +243,7 @@ func (s *LocalDirV1) handleV1Query(w http.ResponseWriter, r *http.Request) { if schema == "" && pkg == "" && name == "" { // If no parameters are provided, return the entire catalog (this is the same as /api/v1/all) - w.Header().Add("Content-Type", "application/jsonl") - http.ServeContent(w, r, "", catalogStat.ModTime(), catalogFile) + serveJSONLines(w, r, catalogFile) return } idx, err := s.getIndex(catalog)