title: Incomplete data using request.js
body: <p>I'm using request.js to download the content of a web page, but I need to wait until the dom is completely loaded before using it. Here is my code:</p>
  
  <pre><code>function requestPage(id) {
  var options = {
      method: 'GET',
      gzip: true,
      url: 'xxx' + id,
      headers: getHeaders
  }
  
  request(options, function(error, response, body) {
      if (response.statusCode == 200) {
          generatePDF(generateHTML(body, id),id)
      }
  })
  }
  </code></pre>
  
  <p>How can I wait until everything is loaded before using the response in my generateHtml function?</p>