title: Is there a way to check the body of a Node.js https request before I send it?
body: <p>I'm trying to debug some API calls, and I want to confirm that I'm sending what I think I'm sending.</p>
  
  <pre><code>var req = https.request(request, function(res) {
    var body;
    res.setEncoding('utf8');
    body = "";
    res.on('data', function(chunk) {
      return body += chunk;
    });
    res.on('end', function() {
      if (res.statusCode === 200) {
        return settings.success(null, JSON.parse(body), res);
      } else {
        return settings.error(body, null, res);
      }
    });
    return res.on('error', function() {
      return settings.error(null, Array.prototype.slice.apply(arguments), res);
    });
  });
  if (settings.data != null) {
    req.write(settings.data);
  }
  // check body of req here
  </code></pre>
  
  <p><code>settings.data</code> is a protobuf buffer. I want to check the final written body because there is a bug somewhere in the call and I would like to see exactly what I am sending. Can anyone help?</p>