How to allow Binary File download using GRAPE API
问题 I want to allow downloading a binary file (.p12 file) using ruby's Grape API. This is what I am trying. get '/download_file' do pkcs12 = generate_pkcsfile content_type('application/octet-stream') body(pkcs12.der) end The equivalent code using ActionController is begin pkcs12 = generate_pkcsfile send_data(pkcs12.der, :filename => 'filename.p12') end The problem is the file downloaded using the API seems to be a text file with a '\ufffd' prefix embedded for every character, whereas the file