If you are trying to debug your headers:
Start listening on some port:
nc -kl 1234
Then just send a request to that port:
require 'mechanize'
agent = Mechanize.new
agent.get('http://localhost:1234')
Afterwards you will see all the headers sent to on the terminal screen where you'd ran nc
command.
GET / HTTP/1.1
Accept-Encoding: gzip,deflate,identity
Accept: */*
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Host: localhost:1234
Connection: keep-alive
Keep-Alive: 300