Sha256: c6b9659944d92e9abaaf4fbaed26e6459d176bd66674047fe756a66cc61eaa04

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

module Restfulie::Client::Feature

  class SetupHeader
    
    def execute(flow, request, response, env)
      headers = request.default_headers.dup.merge(request.headers)
      host = request.host
      if host.user || host.password
        headers["Authorization"] = "Basic " + ["#{host.user}:#{host.password}"].pack("m").delete("\r\n")
      end
      headers.delete :recipe
      headers['cookie'] = request.cookies if request.cookies
      
      # gs: this should not be overriden, do it in some other way
      request.headers = headers
      
      flow.continue(request, response, env)
    end
    
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restfulie-1.0.0.beta1 lib/restfulie/client/feature/setup_header.rb
restfulie-0.1.0.beta1 lib/restfulie/client/feature/setup_header.rb