httpx icon indicating copy to clipboard operation
httpx copied to clipboard

feat(content): allow multipart requests without files.

Open laipz8200 opened this issue 1 year ago • 6 comments
trafficstars

Summary

related #3396.

Currently, a multipart request can only be sent when the files parameter is non-empty. This restriction limits cases where users might want to send data using multipart mode without attaching any files, which is possible in tools like Postman.

Change: Instead of requiring files to be non-empty, we could determine the need for a multipart request based on whether files is None rather than its emptiness. This would allow users to send multipart requests without attaching files if needed.

I think there is no significant documentation update required, so I have not made any changes. However, please let me know if any updates are needed.

Checklist

  • [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [x] I've updated the documentation accordingly.

laipz8200 avatar Nov 08 '24 06:11 laipz8200