KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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 downloaded using the browser seems to be binary file. How do I use the GRAPE API framework to allow downloading the same file that is downloaded via ActionController's send_data
Tags (comma-separated)
Save Edits
Cancel