How to send custom headers in OpenURI (Ruby) and check them
<p>Found this in the following doc: <a href="https://ruby-doc.org/stdlib-2.1.0/libdoc/open-uri/rdoc/OpenURI.html" rel="nofollow noreferrer">https://ruby-doc.org/stdlib-2.1.0/libdoc/open-uri/rdoc/OpenURI.html</a></p>
<blockquote>
<p>Additional header fields can be specified by an optional hash argument.</p>
<pre><code> open(&quot;http://www.ruby-lang.org/en/&quot;,
   &quot;User-Agent&quot; =&gt; &quot;Ruby/#{RUBY_VERSION}&quot;,
   &quot;From&quot; =&gt; &quot;foo@bar.invalid&quot;,
   &quot;Referer&quot; =&gt; &quot;http://www.ruby-lang.org/&quot;) {|f|
   # ...
 }
</code></pre>
</blockquote>
<p>Can someone tell me how to check whether this is working properly?</p>