Skip to content

Add support for passing list[tuple[str, object]] to data #2330

Answered by adriangb
RobertCraigie asked this question in Ideas
Discussion options

You must be logged in to vote

As far as I know there is no standard way to serialize nested objects in multipart/form-data requests. What you are describing corresponds to what Swagger/OpenAPI calls the "deepObject" serialization method: https://swagger.io/docs/specification/serialization/.

The multipart/form-data spec only states that fields may be singular or repeated. You can send a repeated field like: httpx.post(..., data={"documents": ["doc1", "doc2"], files=...). This will result in "duplicate" data being transmitted. You could also do something like httpx.post(..., data={"documents": json.dumps( ["doc1", "doc2"]), files=...) in which case there's no duplicate data but the server has to know that the field is J…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@falkben
Comment options

@tomchristie
Comment options

@falkben
Comment options

@tomchristie
Comment options

@falkben
Comment options

Answer selected by tomchristie
Comment options

You must be logged in to vote
1 reply
@tomchristie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
5 participants