def default_middleware(options={})
      Proc.new do |builder|
        #builder.use BitBucket::Request::Jsonize
        builder.use Faraday::Request::Multipart
        builder.use Faraday::Request::UrlEncoded
        builder.use FaradayMiddleware::OAuth, {:consumer_key => client_id, :consumer_secret => client_secret, :token => oauth_token, :token_secret => oauth_secret} if client_id? and client_secret?
        builder.use BitBucket::Request::BasicAuth, authentication if basic_authed?
        builder.use FaradayMiddleware::EncodeJson

        builder.use Faraday::Response::Logger if ENV['DEBUG']
        builder.use BitBucket::Response::Helpers
        unless options[:raw]
          builder.use BitBucket::Response::Mashify
          builder.use BitBucket::Response::Jsonize
        end
        builder.use BitBucket::Response::RaiseError
        builder.adapter adapter
      end
    end
def default_middleware(options={})
      Proc.new do |builder|
        #builder.use BitBucket::Request::Jsonize
        builder.use Faraday::Request::Multipart
        builder.use Faraday::Request::UrlEncoded
        builder.use FaradayMiddleware::OAuth, {:consumer_key => client_id, :consumer_secret => client_secret, :token => oauth_token, :token_secret => oauth_secret} if client_id? and client_secret?
        builder.use BitBucket::Request::BasicAuth, authentication if basic_authed?
        builder.use FaradayMiddleware::EncodeJson

        builder.use Faraday::Response::Logger if ENV['DEBUG']
        builder.use BitBucket::Response::Helpers
        unless options[:raw]
          builder.use BitBucket::Response::Mashify
          builder.use BitBucket::Response::Jsonize
        end
        builder.use BitBucket::Response::RaiseError
        builder.adapter adapter
      end
    end
Default middleware stack that uses default adapter as specified at
 configuration stage.