CuriousMind
CuriousMind

Reputation: 34145

print raw http headers in ruby

for example, in shell, I could use curl & do

curl -I http://google.com

and it would print out raw http headers. what's the alternative of this in ruby?

Question being, how to print raw http headers in Ruby?

Upvotes: 2

Views: 471

Answers (1)

fl00r
fl00r

Reputation: 83680

require 'open-uri'
open("http://google.com"){|f| p f.meta }

Upvotes: 4

Related Questions