I am creating some kind of proxy. When I call some URL in the rack application, I forward this request to another URL.
The request I forward is a POST with a file and some parameters.
I want to add additional parameters.
But the file can be quite large. Therefore, I am sending it with Net::HTTP#body_streaminstead Net::HTTP#body.
I receive my request as an object Rack::Request, and I create my Net :: HTTP object with this.
req = Net::HTTP::Post.new(request.path_info)
req.body_stream = request.body
req.content_type = request.content_type
req.content_length = request.content_length
http = Net::HTTP.new(@host, @port)
res = http.request(req)
I tried several ways to add proxy settings. But there is nothing in Net :: HTTP that allows you to add parameters to the body_stream request, only to the unit of the body.
Is there an easier proxy way to request a rack? Or an easy way to add my parameters to my request?