
exports = module.exports = {
  flowdock: function () {
    this.before.all = function (endpoint, options) {
      if (options.auth && options.auth.bearer) {
        // apikey
        if (options.auth.bearer.length < 35) {
          options.auth = {user:options.auth.bearer}
        }
      }
    }
  },
  getpocket: function () {
    this.before.all = function (endpoint, options) {
      if ('object'===typeof options.body) {
        options.body = JSON.stringify(options.body)
      }
      options.json = false
    }
  },
  google: function () {
    this.url.endpoint = function (endpoint, options) {
      var api = options.api||this.provider.api
      if (api == 'gmaps') {
        // append /json to certain endpoints in the gmaps api
        var match = endpoint.match(
          /(?:geocode|directions|timezone|elevation|distancematrix)(?:\/(json|xml))?/)
        return (match && !match[1])
          ? endpoint + '/json'
          : endpoint
      }
      else {
        return endpoint
      }
    }
  },
  hackpad: function () {
    this.options.oauth = function (options) {
      options.oauth = options.oauth||{}
      // 0-legged OAuth
      options.oauth = {
        consumer_key: options.oauth.consumer_key||this.provider.key,
        consumer_secret: options.oauth.consumer_secret||this.provider.secret
      }
      if (!options.oauth.consumer_key || !options.oauth.consumer_secret)
        throw new Error('Missing OAuth credentials!')
    }
  },
  imgur: function () {
    this.before.all = function (endpoint, options) {
      if (options.auth && options.auth.bearer.length < 20) {
        options.headers['authorization'] = 'Client-ID '+options.auth.bearer
        // extend(true, options.headers, {
        //   Authorization: 'Client-ID '+options.auth.bearer
        // })
        delete options.auth
      }
    }
  },
  linkedin: function () {
    this.before.post = function (endpoint, options) {
      // linkedin expects the data as JSON
      if (options.form) {
        options.json = options.form
        delete options.form
      }
    }
  },
  mailchimp: function () {
    this.url.domain = function (domain, options) {
      // https://login.mailchimp.com
      if (domain.indexOf('[domain]') == -1) {
        return domain
      }
      // options
      else if (options.domain) {
        var _domain = options.domain
        delete options.domain
        return domain.replace('[domain]', _domain)
      }
      // extract the domain from the apikey
      else if (options.qs && /.*-\w{2}\d+/.test(options.qs.apikey)) {
        var _domain = options.qs.apikey.replace(/.*-(\w{2}\d+)/,'$1')
        return domain.replace('[domain]', _domain)
      }
      // token
      else {
        throw new Error(
          'Purest: specify domain name to use through the domain option!')
      }
    }
  },
  openstreetmap: function () {
    this.before.all = function (endpoint, options) {
      if (options.oauth.token.length < 30) {
        options.auth = {
          user: options.oauth.token,
          pass: options.oauth.token_secret
        }
        delete options.oauth
      }
    }
  },
  paypal: function () {
    this.url.domain = function (domain, options) {
      if (options.domain == 'sandbox') {
        delete options.domain
        return domain.replace('api','api.sandbox')
      }
      else {
        return domain
      }
    }
  }
}

@@ -1625,49 +1625,19 @@
 ders
-%5B'authorization'%5D = 'Client-ID '+
+ = 
 options.
 auth
@@ -1628,35 +1628,37 @@
 s = options.
-auth.bear
+head
 er
+s %7C%7C %7B%7D
 %0A        // 
@@ -1658,57 +1658,26 @@
     
-// extend(true, options.headers, %7B%0A        //   A
+options.headers%5B'a
 utho
@@ -1684,17 +1684,20 @@
 rization
-:
+'%5D =
  'Client
@@ -1726,22 +1726,8 @@
 rer%0A
-        // %7D)%0A
     

Fix imgur override