mercredi 16 novembre 2016

How to send custom headers in open-uri (ruby) and check them

Found this in the following doc:http://ift.tt/2e9ePyn

Additional header fields can be specified by an optional hash argument.

open("http://ift.tt/pGelD4",
  "User-Agent" => "Ruby/#{RUBY_VERSION}",
  "From" => "foo@bar.invalid",
  "Referer" => "http://ift.tt/uOONaF") {|f|
   # ...
}

Can someone tell how to check whether they are properly working.

Aucun commentaire:

Enregistrer un commentaire