httpx icon indicating copy to clipboard operation
httpx copied to clipboard

Updated _content.py: encode_content to accept a bytearray non-streamed content

Open jcekstrom opened this issue 6 months ago • 0 comments

Summary

Updated _content.py: encode_content to accept a bytearray as well as bytes/str as a static content type. This allows sending a mutable bytearray without having to cast to an immutable bytes object, trigging a memory copy before sending.

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.

jcekstrom avatar Jun 24 '25 16:06 jcekstrom