How to build streaming API with Ruby Grape? -
i want build api grape, post file through http streaming. how that?
ps grape example of rack-stream couldn't work
error info: http/1.1 503 service unavailable
i want make grape can handle request this:
net::http.new('localhost', 9292).start |h| req = net::http::post.new('/api/http_streaming_post') file.open('binary_file.bin') |f| req.body_stream = f req['content-length'] = f.lstat.size.to_s req['content-type'] = 'text/html;charset=utf-8' response = h.request req end end
i don't know how it.
after found reading body_stream in sinatra, use sinatra instead.
Comments
Post a Comment