Closed ziima closed 4 months ago
Definitely related to a files pattern. I haven't looked at how data changes, but it would be interesting to see if it would be possible to reconstruct without implementing the same logic as httpx
has 🤔.
If we can solve this one, both issues would probably be solved, which is great.
@ziima Thanks for the idea/suggestion in #115 to use the email
module for extracting the encoded form data.
The new respx.utils.decode_data
will need to be improved to add support for matching files, but should be a lot easier now that the surrounding decoding is in place.
Please try this PR on your code, if possible, to rule out any new bugs 🙏 🤞
One potential bug is if a regular form text field together with a file without filename and content type text/plain
is provided. Not sure, but my gut feeling says that this could get mixed up. If so, I'm not sure how to distinguish them 🤔
Data
pattern only handles urlencoded data, not multipart encoded. This is troublesome because by addition offiles
to the request, the encoding changes andData
pattern fails to match the request.MWE
Related to #115