title: Returned unirest response in node.js is undefined
body: <p>I am working on facebook bot, but I am in no way a node.js developer, this being my first time in using it, because I wanted to get out of my comfort zone for a little bit.</p>
  
  <p>This is my request function</p>
  
  <pre><code>function requestExc() {
      var resDictionary = {} 
      unirest.get("http://openapi.ro/api/exchange/" + queryDict["code"] + ".json")
      .query({"date" : queryDict["date"]})
      .end(function(res) {
          if (res.error) {
              console.log('GET error', res.error)
          } else {
              console.log('GET response', res.body)
              resDictionary["rate"] = res.body["rate"]
              resDictionary["date"] = res.body["date"]
          }
      })
  
      console.log("resDictionary IS " + resDictionary)
      ///prints resDictionary IS [object Object]
      return resDictionary
  }
  </code></pre>
  
  <p>so I am trying to get it's result</p>
  
  <pre><code>var response = requestExc()
  if (response !== null) {
      respondToSender(response, sender)
  }
  </code></pre>
  
  <p>and then act accordingly </p>
  
  <pre><code>function respondToSender(res, sender) {
      console.log("RES IS " + res)
      //prints RES IS [object Object]
    if (res["rate"] === null) {
          //do stuff
    }
  }
  </code></pre>
  
  <p>but when the variable gets to the respondToSender it's always undefined. </p>
  
  <pre><code> TypeError: Cannot read property 'rate' of undefined
  </code></pre>
  
  <p>I've also tried with Json.parse() but it's the same thing.</p>