title: Load pdf from remote url to send as Mandrill attachment
body: <p>I am trying to load a Pdf in Cloud Code and send it as an attachment with mandrill.</p>
  
  <p>As mandrill needs a base64 encoded string for the attachment I use Buffer to change the encoding.</p>
  
  <p>The result right now is an Pdf attachment that cannot be opened and I think the error is caused by my recoding. </p>
  
  <p>I guessed the text returned from the get request is utf8 but I'm not sure.</p>
  
  <p>Any suggestions?</p>
  
  <p>var Buffer = require('buffer').Buffer;</p>
  
  <pre><code>function loadPdf(pdfUrl) {
    var promise = new Parse.Promise();
  
    Parse.Cloud.httpRequest({
      method: 'GET',
      url: pdfUrl,
      success: function (httpResponse) {
        // Put text into buffer
        var buf = new Buffer('httpResponse.text', 'utf8');
        // encode text with base64
        promise.resolve(buf.toString('base64'));
      },
      error: function (httpResponse) {
        console.error(httpResponse);
        console.error("Token Request failed with response code " + httpResponse.status);
      }
    });
    return promise;
  }
  </code></pre>
  
  <p>the result of this function is put into </p>
  
  <pre><code>"attachments": [
      {
          "type": "application/pdf",
          "name": "test.pdf",
          "content": encodePdfText
      }
  </code></pre>