[Bug]: Chunked request in requestes
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 368
- Forks
- 140
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-openapi/openapi-core
-
kind/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python-openapi/openapi-core#1188 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1225 · 2 comments ·
-
kind/bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
python-openapi/openapi-core#1212 ·
-
[Bug]: Query parameter validation fails to match empty string when listed as a valid enum value Openkind/bug
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-openapi/openapi-core#1210 ·
-
kind/bug kind/bug/confirmed
Difficulty 3/5 1-2 days Newbie friendliness 58/100
python-openapi/openapi-core#1180 · 3 comments ·
All issues in python-openapi/openapi-core
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
learningequality/ricecooker#747 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
run-llama/llama_index#23199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
KhronosGroup/glTF-Blender-IO#2769 ·