nodejs / nodejs/node

Missing `Http2ServerResponse.setHeaders()`

Đang mở
#51,573 6 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

feature request http2
Ngôn ngữ chính
JavaScript
Star
122k
Fork
37.3k
Merge trung bình
4 ngày 2 giờ
Pull request đã merge (30 ngày)
283

Mô tả

What is the problem this feature will solve?

Make it possible to use response.setHeaders() on both old HTTP response objects and ones coming from node:http2.

BTW I wasn't sure if this should be a "feature request" or a "bug."

What is the feature you are proposing to solve the problem?

Add the method http2.Http2ServerResponse.setHeaders() to have the same API as http.OutgoingMessage.setHeaders().

See https://nodejs.org/api/http.html#outgoingmessagesetheadersheaders.

What alternatives have you considered?
  • Avoiding using setHeaders() at all.
  • Monkey-patching Http2ServerResponse.
  • Just writing two versions of my own set-headers code, on the assumption that, when available, setHeaders() is the most efficient option.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với entry point node:http2 Http2ServerResponse và so sánh API của nó với http.OutgoingMessage.setHeaders(), sử dụng tài liệu HTTP được liên kết làm tài liệu tham chiếu về hành vi. Được xem là hoàn thành khi Http2ServerResponse expose setHeaders() với cùng API và hành vi như các đối tượng phản hồi HTTP hiện có, cùng với mức coverage phù hợp cho phương thức mới.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, node.js
Lĩnh vực
api, backend
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.