Http: a bodyless GET is sent with Content-Type: text/plain, and with no User-Agent (GitHub's API answers 403)
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #534 của @lukewilliamboswell — đã merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 57/100
Hướng nghiên cứu
Start by locating Http.send! and send_streaming!, then trace how they add default headers when building a request. Check the HTTP tests for bodyless GET requests and requests with a caller supplied User-Agent. Done means the defaults match the intended behavior for both cases, with tests covering each.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Two default headers surprised me while porting a tool to 0.26.0-rc3:
1. A bodyless GET is sent with Content-Type: text/plain. send_streaming! adds Content-Type: text/plain to any request that does not set one, even when there is no body. What Http.send! sends for Request.from_method(GET).with_uri("http://127.0.0.1:18099/x"), captured with nc -l -p 18099:
GET /x HTTP/1.1
content-type: text/plain
host: 127.0.0.1:18099
A Content-Type describes content, and this request has none. Servers mostly ignore it, but a strict one can refuse it, and it is a header the caller never asked for. Suggestion: add the default only when the body is not empty, or not at all.
2. No User-Agent. GitHub's REST API refuses requests without one:
api = Http.send!(Request.from_method(GET).with_uri("https://api.github.com/repos/roc-lang/basic-cli/branches/main"), {})?
# Response.status(api) == 403
With .add_header("User-Agent", "something") it answers 200. curl, Go's net/http and Python's urllib each send one by default. GitHub is probably the most common API a CLI script talks to, and a 403 with a body about a missing User-Agent is easy to miss. Suggestion: a default such as roc-basic-cli/0.26, replaced by any User-Agent the request sets. Or a line in Http's docs, if a default is not wanted.
Seen on 0.26.0-rc3, Roc nightly-2026-10-17-5f126ac and -10-19, Linux x86_64. Thank you for rc3: details on how it went for us are in #529.
- Ngôn ngữ chính
- Rust
- Star
- 122
- Fork
- 47
- Merge trung bình
- 11 giờ 6 phút
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 roc-lang/basic-cli
-
Unix socket supportĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
roc-lang/basic-cli#500 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
roc-lang/basic-cli#482 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
roc-lang/basic-cli#455 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 32/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của roc-lang/basic-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
git-ai-project/git-ai#2434 ·
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 84/100
peteonrails/voxtype#909 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
kucherenko/jscpd#1239 ·
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 76/100
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 69/100
alchemyplatform/rundler#1358 ·
Maintainer thường phản hồi trong vòng 3 ngày