Class: WWW::Mechanize::Chain::CustomHeaders

Inherits:
Object
  • Object
show all
Includes:
Handler
Defined in:
lib/www/mechanize/chain/custom_headers.rb

Instance Attribute Summary

Attributes included from Handler

#chain

Instance Method Summary collapse

Instance Method Details

#handle(ctx, params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/www/mechanize/chain/custom_headers.rb', line 7

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