Instantly share code, notes, and snippets.

Embed
What would you like to do?
Twitter connect close issue patch
# monkey patch to correct Twitter gem experiencing EOF errors
# thread here: https://dev.twitter.com/discussions/15989#comment-35662
# add any where to your code before using the Twitter gem
module Twitter
class Client
def connection
@connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware)) do |f|
f.headers = { "Connection" => "" }
end
end
end
end
@dangerp

This comment has been minimized.

dangerp commented Mar 22, 2013

Thanks for the workaround! I would modify to keep the method private, and only change the key in the headers that is relevant:

module Twitter
  class Client
    private
    def connection
      @connection ||= Faraday.new(@endpoint, @connection_options.merge(:builder => @middleware)) do |f|
        f.headers["Connection"] = ""
      end
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment