class HTTP::Client

def make_request_body(opts, headers)

Create the request body object to send
def make_request_body(opts, headers)
  case
  when opts.body
    opts.body
  when opts.form
    form = HTTP::FormData.create opts.form
    headers["Content-Type"]   ||= form.content_type
    headers["Content-Length"] ||= form.content_length
    form.to_s
  when opts.json
    headers["Content-Type"] ||= "application/json"
    MimeType[:json].encode opts.json
  end
end