Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Feat. Request: HttpRequest/HttpResponse convenience methods.

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

Maintainer thường phản hồi trong vòng 1 ngày

@sylvesterkaczmarek đang làm issue này rồi.

Từ ngày 21/8/2026.

  • #923 của @sylvesterkaczmarek — đang mở

Đánh giá

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

Hướng nghiên cứu

Xác định các định nghĩa của HttpHeaders, HttpRequestBody và HttpResponseBody, sau đó kiểm tra các API names(), values() và writeTo(OutputStream) hiện có. Công việc được xem là hoàn tất khi cung cấp quyền truy cập thuận tiện vào header và InputStream cho request body và response body, đồng thời giữ nguyên hành vi hiện có; issue không nêu các test hoặc file cụ thể cần chạy.

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

Mô tả

enhancement sdk

Description

In order to implement the HttpClient interface in Java to embed a custom HttpClient in the SDK, there is the need to implement some ellaborate mapping for a few entities in the HttpRequest/HttpResponse.

1. Headers

Currently one can iterate through names and then get a List<String> for each. This results in code that looks like this:

HttpHeaders target = new HttpHeaders();
sourceHeaders.names().forEach(name -> {
    List<String> values = sourceHeaders.values(name);
    HttpHeaderName headerName = HttpHeaderName.fromString(name);
    if (values.isEmpty()) {
        target.set(headerName, "");
    } else {
        target.set(headerName, values);
    }
});
return target;

It would be nice to have something that returns the Headers as Map<String, String> or even Map<String, List<String>>

2. HttpResponseBody

Given the API, one has to "double read" the content of the body by calling fun writeTo(outputStream: OutputStream)

It would be nice to have an alternative that would return an java.io.InputStream so we can pipe the body directly to our type.

3. HttpRequestBody

Same as the above. Having the contents of the body returned as an InputStream would make things more ergonomic for us.

Thank you!

Ngôn ngữ chính
Kotlin
Star
1.5k
Fork
266
Merge trung bình
11 giờ 31 phút
Pull request đã merge (30 ngày)
150

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

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.

Issue khác của openai/openai-java

Tất cả issue của openai/openai-java

Issue tương tự

Thêm issue về Kotlin

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.