I have a RestClient that does the following call:
RestClient::Request.new(
:method => "post",
:url => "http://myservice.com/call.json",
:payload => {'document[data]' => File.new(e.image.path, 'rb')},
:headers => { :accept => :json, :content_type => :json}
).execute
I've implemented a little test server that receives the rest call, since i'm not the author of the REST service. Below you find what the request actually is and what it should be. My question is: where do I specify the mime type of the file attached?
What it is:
#<ActionDispatch::Http::UploadedFile:0x0... @original_filename="x.pdf", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"document[data]\"; filename=\"x.pdf\"\r\nContent-Type: text/plain\r\n", @tempfile=#>
what it should be instead:
#<ActionDispatch::Http::UploadedFile:0x0... @original_filename="x.pdf", @content_type="application/pdf", @headers="Content-Disposition: form-data; name=\"document[data]\"; filename=\"x.pdf\"\r\nContent-Type: application/pdf\r\n", @tempfile=#>