I have not specified [BUG] here because maybe this is still arguable, but I think something is wrong or at least missing.
This concerns how content disposition headers such as 'filename' on multipart/form-data payloads are handled inside the python asyncio client. These headers currently always get URL-encoded, which I think is not desirable or at least should be configurable. As far as I understand it, the specification does not require URL encoding for this content type (see for example https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST and https://datatracker.ietf.org/doc/html/rfc7578#section-4.2), and users of the generated client might therefore pass in, for example, file names containing spaces or other non-URLable characters with the reasonable expectation that these arrive at the destination service as-is. But they don't.
Starting here the template handles application/x-www-form-urlencoded and multipart/form-data using aiohttp.FormData(). The default values on initializing this class unfortunately seem to mix some of the behavior appropriate to the form-urlencoded and form-data types, in particular defaulting to URL encoding for all fields, here. This has been noted as a problem before, for example in aio-libs/aiohttp#3910
In theory, there is a very simple change that would fix this, by changing the template here:
- data = aiohttp.FormData()
+ data = aiohttp.FormData(quote_fields=False)
However, I suppose there are likely to be users of openapi-generator out there who are relying on the (arguably incorrect) existing behavior, and this easier change would break their use. So this may need to be made configurable instead.
I am happy to make the simpler but possibly breaking change if that is acceptable, or to discuss how/whether this could be made an option or otherwise worked around.
I have not specified [BUG] here because maybe this is still arguable, but I think something is wrong or at least missing.
This concerns how content disposition headers such as 'filename' on
multipart/form-datapayloads are handled inside the python asyncio client. These headers currently always get URL-encoded, which I think is not desirable or at least should be configurable. As far as I understand it, the specification does not require URL encoding for this content type (see for example https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Methods/POST and https://datatracker.ietf.org/doc/html/rfc7578#section-4.2), and users of the generated client might therefore pass in, for example, file names containing spaces or other non-URLable characters with the reasonable expectation that these arrive at the destination service as-is. But they don't.Starting here the template handles
application/x-www-form-urlencodedandmultipart/form-datausingaiohttp.FormData(). The default values on initializing this class unfortunately seem to mix some of the behavior appropriate to the form-urlencoded and form-data types, in particular defaulting to URL encoding for all fields, here. This has been noted as a problem before, for example in aio-libs/aiohttp#3910In theory, there is a very simple change that would fix this, by changing the template here:
However, I suppose there are likely to be users of openapi-generator out there who are relying on the (arguably incorrect) existing behavior, and this easier change would break their use. So this may need to be made configurable instead.
I am happy to make the simpler but possibly breaking change if that is acceptable, or to discuss how/whether this could be made an option or otherwise worked around.