api: HEAD requests fail for derived JSON endpoints
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
Hướng nghiên cứu
Bắt đầu tại packages/function/src/worker.ts: hàm catalogResponse (khoảng dòng 209-224) và route schema (khoảng dòng 67-73). Cả hai đều gọi .json() trên một asset hoặc phản hồi API, và phần này rỗng với các yêu cầu HEAD. Tái hiện bằng curl -I 'https://models.dev/model-schema.json' và truy vấn nhiều loại api.json?type=.... Hoàn thành khi HEAD trả về cùng trạng thái và header như GET mà không phân tích body, 15 test worker hiện có vẫn pass, và có thêm các test hồi quy HEAD mới cho route schema và route nhiều loại.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
HEAD returns 500 for /model-schema.json and multi-type catalog requests, while the corresponding GET requests return 200. Plain /api.json works with both methods.
Reproduced locally and on the public site; still present on current dev, 8b715df235126f6efcf4ab9b2e41c45f5ec74184.
Reproduction
curl -I 'https://models.dev/api.json' # 200, control
curl -I 'https://models.dev/api.json?type=chat,decision' # 500
curl -I 'https://models.dev/model-schema.json' # 500
curl -sS -o /dev/null -w '%{http_code}\n' \
'https://models.dev/model-schema.json' # GET: 200
Cause
In catalogResponse, the asset request inherits HEAD. The asset correctly has no response body, but the multi-type path calls assetResponse.json(). The schema route similarly calls apiResponse.json(). Both throw SyntaxError: Unexpected end of JSON input.
Local regression tests reproduce this on all four multi-type catalog routes and on schema requests. GET/static-HEAD controls, invalid-type 400 and conditional HEAD/304 pass. A separate real loopback HTTP asset server reproduces the schema failure too. The failures repeated across ten runs; the existing 15 worker tests pass. Environment: macOS 15.6.1/arm64, Bun 1.4.4.
Expected: return the appropriate metadata without parsing a bodyless asset response or sending HEAD response content. See RFC 9110, 9.3.2.
I'd like to work on a fix limited to HEAD handling and regression tests, keeping GET output, type validation, ETags/304s and CORS unchanged. Would that scope fit?
- Ngôn ngữ chính
- TypeScript
- Star
- 7.5k
- Fork
- 2k
- Merge trung bình
- 33 phút
- Pull request đã merge (30 ngày)
- 912
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/models.dev
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
anomalyco/models.dev#12664 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation missing-model model-sync provider:engy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/models.dev#12631 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation missing-model model-sync provider:ollama-cloud
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
anomalyco/models.dev#12624 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation missing-model model-sync provider:fireworks-ai
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/models.dev#12618 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automation missing-model model-sync provider:morph
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
anomalyco/models.dev#12603 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/models.dev
Issue tương tự
-
[Text] Add Reading Time & Word Count Estimator for Reflection Notes in src/lib/text/reading-time.tsĐang mởarea:core beginner-friendly community contributions-welcome difficulty:easy enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[fullsend] E2E: scorecard — filecheck GitLab entity metrics unavailable due to initialDelay timingĐang mởe2e-failure ready-to-code
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
redhat-developer/rhdh-plugin-export-overlays#4698 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
devswha/herdr-web-ui#2884 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
b:minor bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
software-mansion/argent#1771 ·
Maintainer thường phản hồi trong vòng 1 ngày