From: "Shaban K." Date: 2012-10-05T15:43:17+09:00 Subject: NET:HTTP headers ruby gem I am trying to use the NET:HTTP gem to add an api-key to http header of a client, but it just doesn't seem to be working for some reason when I try and test it out.Basically the server requires the http header of the client or anything to have http_x_api header in order to serve the request. Server code require 'sinatra' before do halt 400 if (env['API_KEY']) != 'wow' end get '/' do "boo" end client code require 'net/http' require 'uri' port = ENV['PORT'] || '7474' res = Net::HTTP.start('localhost', port ) { |h| h.get('/')} res.add_field('api-key', 'wow') res.each_header do |key, value| p "#{key} => #{value}" end puts (res.code == '200' && res.body == 'boo') ? 'OK' : 'FAIL' this the response i get back :=> "x-frame-options => sameorigin" "x-xss-protection => 1; mode=block" "content-type => text/html;charset=utf-8" "content-length => 0" "connection => keep-alive" "server => thin 1.5.0 codename Knife" "api-key => wow" FAIL -- Posted via http://www.ruby-forum.com/.