Sha256: d633c665c864034dbd7ee61b3535faf6d12f7acdfcad519408cef01a39a49737

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

class NilClass; def search(*args); []; end; end

Mechanize::Chain::PostConnectHook.class_eval do
  
  def handle(ctx, params)
    headers = params[:response].to_hash
    if headers.has_key?("location")
      headers["location"].each do |location|
        url = URI.parse(location)
        # we want mechanize to return if it sees a redirect back to localhost for facebook
        if url.host == "localhost" && url.port == 4567
          params[:res_klass] = Net::HTTPSuccess
        end
      end
    end
    
    super(ctx, params)
  end
  
end

class Mechanize::CookieJar
  public
  def jar=(hash)
    @jar = hash
  end
  
  def save_string
    return YAML::dump(@jar)
  end

  def load_string(str)
    @jar = YAML::load(str)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ubiquitously-0.1.0 lib/ubiquitously/extensions/mechanize.rb