Passing request header information to app.get

Is there a way to pass request information, such as the value of the HOST header, to app.get?

My application requires a specific host, so when I call it usually the following:

app.get ("Foo")

In particular, I want to override

request.env["HTTP_HOST"] 

value.

TIA

+4
source share
2 answers

I am not sure if this help ... I saw code like the following:

 app.call({ "HTTP_HOST"=>"...", "SCRIPT_NAME" => "", "PATH_INFO"=>"/lala/#{lala_id}/", "QUERY_STRING" => "", "SERVER_NAME" => "", "SERVER_PORT" => "80", "REQUEST_METHOD"=>"GET", "rack.input" => StringIO.new }) 

Perhaps you can use .get and just pass HTTP_HOST as an option, as mentioned above?

0
source

Like this answer :

The docs method for .get is here: http://api.rubyonrails.org/classes/ActionDispatch/Integration/RequestHelpers.html#method-i-get

You can do something like:

  app.get('/foo', nil, {'HTTP_HOST' => "bar.com"}) 
+6
source

All Articles