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[Headers::CONTENT_TYPE]   ||= form.content_type
    headers[Headers::CONTENT_LENGTH] ||= form.content_length
    form.to_s
  when opts.json
    headers[Headers::CONTENT_TYPE] ||= "application/json"
    MimeType[:json].encode opts.json
  end
end