Skip to content

Instantly share code, notes, and snippets.

@waynepan
Created March 22, 2013 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waynepan/5218264 to your computer and use it in GitHub Desktop.
Save waynepan/5218264 to your computer and use it in GitHub Desktop.
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
Copy link

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