def request(client, head, body)
request = client.req
uri = request.uri.join(encode_query(request.uri, request.query))
params = {}
if ["POST", "PUT"].include?(request.method)
head["content-type"] ||= "application/x-www-form-urlencoded" if body.is_a? Hash
form_encoded = head["content-type"].to_s.downcase.start_with?("application/x-www-form-urlencoded")
if form_encoded
CGI.parse(client.normalize_body(body)).each do |k,v|
params[k] = v.size == 1 ? v.first : v
end
end
end
head["Authorization"] = SimpleOAuth::Header.new(request.method, uri, params, @opts)
[head,body]
end