Transport-agnostic HTTP client?

Currently HTTP client is hard bound with an internal tcp/tls socket. What’s your view on making it possible to reuse HTTP code with any IO classes for transport? Something like:

def initialize(istream : IO, ostream : IO)
  ...
end
def initialize(iostream: IO)
  initialize(iostream, iostream)
end

Personally I don’t need it right now, but I can very well imagine a number of usecases where it would be very helpful, for example multi-protocol sockets or IPC with HTTP inside or just manual management of TCP/TLS sockets.

2 Likes

Planned! https://github.com/crystal-lang/crystal/issues/6011

Thanks!