Sha256: ceb93f731901b37c6c8b404d3bbcfe8c9c1b7b52409ee1feb6970d796c4ed37f

Contents?: true

Size: 570 Bytes

Versions: 5

Compression:

Stored size: 570 Bytes

Contents

module WWW
  class Mechanize
    class Chain
      class CustomHeaders
        include WWW::Handler

        def handle(ctx, params)
          request = params[:request]
          params[:headers].each do |k,v|
            case k
            when :etag then request["ETag"] = v
            when :if_modified_since then request["If-Modified-Since"] = v
            else
              raise ArgumentError.new("unknown header symbol #{k}") if k.is_a? Symbol
              request[k] = v
            end
          end
          super
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
eric-mechanize-0.9.3.20090623142847 lib/www/mechanize/chain/custom_headers.rb
knu-mechanize-0.9.3.20090623142847 lib/www/mechanize/chain/custom_headers.rb
tenderlove-mechanize-0.9.3.20090617085936 lib/www/mechanize/chain/custom_headers.rb
tenderlove-mechanize-0.9.3.20090623142847 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.9.3 lib/www/mechanize/chain/custom_headers.rb