How to get rid of charset in response header in Rails

I am trying to create a file upload controller, but unfortunately the rails seem to be tilted to the fact that I am not allowing the encoding to be removed from the header

Content-Type: application / x-octet-stream; encoding = UTF-8

I tried after_filter, headers ['Content-Type'], response.headers ['Content-Type'], etc., but to no avail. UTF-8 just keeps going up. Any ideas why this is happening and how to get rid of it?

+4
source share
1 answer

Just found an alternative way to accomplish this:

head :ok, :content_type => @media.mime_type, :content_disposition => "attachment;filename=#{@media.filename}", :x_sendfile => "#{RAILS_ROOT}/data/#{@media.physname}", :content_transfer_encoding => 'binary' 

If Content-Transfer-Encoding is set to binary, the encoding is no longer added. This was discovered after excavating the source a bit.

+5
source

Source: https://habr.com/ru/post/1337738/


All Articles