     _eb = =>
       @emit 'batch', tasks
       tasks = []
-      
+
     @on 'query', (task) => 
       task.to = task.to.replace @root, ''
       task.id ?= Math.floor(Math.random()*(999999999-1+1)+1)

    @__service = {}
    @_ready = false

    @defaultHeaders = Accept: "application/json", 'X-Stream': 'true'
    @defaultHeaders = _.extend @defaultHeaders, opts.headers if opts?.headers
    @defaultHeaders.Authorization = "Basic " + (new Buffer("#{opts.username}:#{opts.password}").toString('base64')) if opts.password and opts.username


    @__call @__service.batch.endpoint
    , 
      data: tasks
      headers: @defaultHeaders
    ,
      'POST'
    ,
