Sha256: 3a2a05a69d7ae4e3de72278849acc83973d66f9f7907668580a822c0f9922690

Contents?: true

Size: 596 Bytes

Versions: 10

Compression:

Stored size: 596 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.add_field("ETag", v)
            when :if_modified_since then request.add_field("If-Modified-Since", v)
            else
              raise ArgumentError.new("unknown header symbol #{k}") if k.is_a? Symbol
              request.add_field(k,v)
            end
          end
          super
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
mechanize-ntlm-0.9.1 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.0 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.3 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.1 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.4 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.2 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.9.0 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.8.5 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.9.2 lib/www/mechanize/chain/custom_headers.rb
mechanize-0.9.1 lib/www/mechanize/chain/custom_headers.rb