Skip to content

fix: serialize dictionary request bodies as JSON - #8

Open
Shubham-Padkonde wants to merge 2 commits into
HPInc:masterfrom
Shubham-Padkonde:fix/dictionary-json-bodies
Open

Shubham-Padkonde wants to merge 2 commits into
HPInc:masterfrom
Shubham-Padkonde:fix/dictionary-json-bodies

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Oct 2, 2026 •

Copy link
Copy Markdown

The README passes a dictionary to request, but Requests encodes it as form data while the SDK advertises application/json. Nested order objects lose their JSON structure, and an empty dictionary sends no body.

Use Requests' JSON serialization for dictionaries. Pre-serialized strings and bytes retain their existing behavior, including the file-based sample.

Validation: python -m unittest test_oneflow_sdk -q passes. The tests inspect actual prepared HTTP requests while mocking only the network send: nested and empty dictionaries produce valid JSON, and serialized strings/bytes are unchanged. Both dictionary cases fail before the fix. No live orders were submitted. git diff --check passes.

After merging the upstream redirect change, both request tests pass across four inputs. Each also checks the value of allow_redirects at the network send boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant