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

[Bug]: Chunked request in requestes

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

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

Đá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
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
api

Hướng nghiên cứu

Start with the requests integration and the RequestsOpenAPIRequest implementation; the issue provides a proposed RequestsOpenAPIRequestFix that buffers generator request bodies and normalizes the MIME type. Reproduce validation of a chunked request, then verify that the request is buffered and validation succeeds without breaking image bodies or non-generator bodies.

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

Mô tả

kind/bug kind/bug/confirmed
Actual Behavior

Raise exception when tried validate chunked request

Expected Behavior

Buffer request and use for validation

Steps to Reproduce

validate chunked request

OpenAPI Core Version

0.17.1

OpenAPI Core Integration

requests

Affected Area(s)

No response

References

No response

Anything else we need to know?

FIX:

class RequestsOpenAPIRequestFix(RequestsOpenAPIRequest):
    def __init__(self, *args):
        super().__init__(*args)
        self._body_buffer = ''

    @property
    def mimetype(self) -> str:
        return super().mimetype.split(';')[0]

    @property
    def body(self) -> Optional[str]:
        if isinstance(self.request.body, types.GeneratorType):
            for part in self.request.body:
                self._body_buffer += part.decode('utf-8')
            return self._body_buffer
        if self.mimetype.startswith('image'):
            return None
        return super().body
Would you like to implement a fix?

None

Ngôn ngữ chính
Python
Star
368
Fork
140
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

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.

Issue khác của python-openapi/openapi-core

Tất cả issue của python-openapi/openapi-core

Issue tương tự

Thêm issue về Python

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.