def default_middleware(options={})
      Proc.new do |builder|
        unless options[:with_attachments]
          builder.use Nimbu::Request::Json
        end
        builder.use Faraday::Request::Multipart
        builder.use Faraday::Request::UrlEncoded
        builder.use Nimbu::Request::OAuth2, oauth_token if oauth_token?
        builder.use Nimbu::Request::BasicAuth, authentication if basic_authed?
        builder.use Nimbu::Request::UserAgent
        builder.use Nimbu::Request::SiteHeader, subdomain
        builder.use Nimbu::Request::ContentLocale, content_locale

        builder.use Faraday::Response::Logger if ENV['DEBUG']
        builder.use Nimbu::Response::RaiseError
        unless options[:raw]
          builder.use Nimbu::Response::Mashify
          builder.use Nimbu::Response::Json
        end
        builder.adapter adapter
      end
    end
def default_middleware(options={})
      Proc.new do |builder|
        unless options[:with_attachments]
          builder.use Nimbu::Request::Json
        end
        builder.use Faraday::Request::Multipart
        builder.use Faraday::Request::UrlEncoded
        builder.use Nimbu::Request::OAuth2, oauth_token if oauth_token?
        builder.use Nimbu::Request::BasicAuth, authentication if basic_authed?
        builder.use Nimbu::Request::UserAgent
        builder.use Nimbu::Request::SiteHeader, subdomain
        builder.use Nimbu::Request::ContentLocale, content_locale

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