Implement common trait(s) to expose common traits of HTTP message (header) types
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Không có tệp mã nguồn, bài kiểm thử hoặc điểm vào nào được nêu tên. Hãy bắt đầu bằng cách so sánh dữ liệu version, headers và extensions dùng chung trên Request, Response, request::Parts và response::Parts. Được xem là hoàn thành khi thống nhất và triển khai một interface chung, hoặc các triển khai AsRef được đề xuất, với phạm vi bao phủ cho các trường hợp sử dụng request-parts và response đã nêu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
All HTTP messages in the http crate contain a bunch of shared data: the version, the headers and the extensions. Both the Request and the Response also allow callers to separate the headers part of a message from the body, resulting in two Parts types that both carry all three of these fields, so there are 4 types in total that share the same underlying data. It would be nice if there was a way to abstract over this data.
For my purposes, I mostly care about the HeaderMap<HeaderValue> -- my direct use case is that I have a function that makes it easier to extract the header's value as a &str and would like to apply this easily to both a request::Parts (which our framework uses internally to carry around request state) and a Response -- but it might make sense to take care of all three in one interface.
We could just have four impl AsRef<HeaderMap<HeaderValue>> for all four of these types as a minimal solution, or we could implement a custom trait, maybe like this:
trait HttpMessage {
fn version(&self) -> Version;
fn headers(&self) -> &HeaderMap<HeaderValue>;
fn extensions(&self) -> &Extensions;
}
- Ngôn ngữ chính
- Rust
- Star
- 1.4k
- Fork
- 378
- Merge trung bình
- 1 ngày 21 giờ
- Pull request đã merge (30 ngày)
- 5
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 hyperium/http
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
Tất cả issue của hyperium/http
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yantrikos/yantrik-os#255 ·
-
Replayed reasoning items send "content": null, which the Responses API schema does not permit Đang mởbug CLI custom-model
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
raphamorim/rio#1956 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
rust-bitcoin/rust-bitcoin#6930 · 1 bình luận ·