hackney
hackney copied to clipboard
Treat iolist of empty binaries as empty body
Normally when the request body is empty, handle_body is only called for POST and PUT requests, since other methods shouldn't have Content-Type and Content-Length headers for empty bodies. But one case is missed in the empty body detection, an iolist containing empty binaries. The gleam hackney wrapper represents empty bodies as [<<>>], triggering this bug and causing https://github.com/gleam-lang/hackney/issues/5.
This PR expands the empty body detection to check if the result of iolist_to_binary is empty.
I rebased and added some integration tests.