 fs = require 'fs-plus'
 path = require 'path'
+{remote} = require 'electron'
 
-glob = null    # defer until used
-request = null # defer until used
-DefaultRequestHeaders = {'User-Agent': navigator.userAgent}
+glob = require 'glob'
+request = require 'request'
 
 module.exports =
 class AtomIoClient

      callback(null, null)
    else
      imagePath = @avatarPath login
      request ?= require 'request'
      requestObject = {
        url: "https://avatars.githubusercontent.com/#{login}"
        headers: DefaultRequestHeaders
      }
      request.head requestObject, (error, response, body) ->
        if error? or response.statusCode isnt 200 or not response.headers['content-type'].startsWith('image/')

        children.forEach(deleteAvatar)

  getCachePath: ->
    @cachePath ?= path.join(remote.app.getPath('userData'), 'Cache', 'settings-view')
