class HTTP::Request::Body

def rewind(io)

def rewind(io)
  io.rewind if io.respond_to? :rewind
rescue Errno::ESPIPE, Errno::EPIPE
  # Pipe IOs respond to `:rewind` but fail when you call it.
  #
  # Calling `IO#rewind` on a pipe, fails with *ESPIPE* on MRI,
  # but *EPIPE* on jRuby.
  #
  # - **ESPIPE** -- "Illegal seek."
  #   Invalid seek operation (such as on a pipe).
  #
  # - **EPIPE** -- "Broken pipe."
  #   There is no process reading from the other end of a pipe. Every
  #   library function that returns this error code also generates
  #   a SIGPIPE signal; this signal terminates the program if not handled
  #   or blocked. Thus, your program will never actually see EPIPE unless
  #   it has handled or blocked SIGPIPE.
  #
  # See: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
  nil
end