[Bug]: Chunked request in requestes
还没有人认领这个 Issue。
评估
调研方向
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.
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- Python
- 星标
- 368
- 派生
- 140
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-openapi/openapi-core 的其他 Issue
-
kind/bug
难度 2/5 1-3 小时 新手友好度 68/100
python-openapi/openapi-core#1188 · 2 条评论 ·
-
kind/bug
难度 3/5 1-2 天 新手友好度 68/100
python-openapi/openapi-core#1225 · 2 条评论 ·
-
kind/bug
难度 3/5 1-2 天 新手友好度 76/100
python-openapi/openapi-core#1212 ·
-
kind/bug
难度 3/5 1-2 天 新手友好度 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
难度 3/5 1-2 天 新手友好度 58/100
python-openapi/openapi-core#1180 · 3 条评论 ·
查看 python-openapi/openapi-core 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
learningequality/ricecooker#747 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 76/100
run-llama/llama_index#23199 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
KhronosGroup/glTF-Blender-IO#2769 ·