lib/http/client.rb in http-1.0.4 vs lib/http/client.rb in http-2.0.0.pre
- old
+ new
@@ -159,11 +159,12 @@
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
+ body = MimeType[:json].encode opts.json
+ headers[Headers::CONTENT_TYPE] ||= "application/json; charset=#{body.encoding.name}"
+ body
end
end
end
end