title: HTTP POST payload not visible in Chrome debugger?
body: <p>I have checked out <a href="https://stackoverflow.com/questions/15603561/how-can-i-debug-a-http-post-in-chrome">this</a> and <a href="https://stackoverflow.com/questions/9163251/chrome-source-of-post-data">that</a>. However, my debugger looks like below.</p>
  <h1>Failure example</h1>
  <p><a href="https://i.stack.imgur.com/qJDcD.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qJDcD.png" alt="No form data, No raw content" /></a>.</p>
  <p>No form data, No raw content</p>
  <p>Raw example (* Although path is different from the screen capture, both of them are unable to read post data)</p>
  <pre><code>POST https://192.168.0.7/cgi-bin/icul/;stok=554652ca111799826a1fbdafba9d3ac1/remote_command HTTP/1.1
  Host: 192.168.0.7
  Connection: keep-alive
  Content-Length: 419
  accept: application/json, text/javascript, */*; q=0.01
  Origin: https://192.168.0.7
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
  content-type: application/x-www-form-urlencoded; charset=UTF-8
  Referer: https://192.168.0.7/cgi-bin/icul/;stok=554652ca111799826a1fbdafba9d3ac1/smartmomentl/access-point/network
  Accept-Encoding: gzip, deflate
  Accept-Language: en-US,en;q=0.8,zh-TW;q=0.6,zh;q=0.4
  Cookie: sysauth=f15eff5e9ebb8f152e163f8bc00505c6
  
  command=import&amp;args=%7B%22--json%22%3Atrue%2C%22--force%22%3Atrue%2C%22--mocks%22%3A%22%7B%5C%22DEL%5C%22%3A%7B%7D%2C%5C%22SET%5C%22%3A%7B%5C%22dhcp%5C%22%3A%7B%5C%22lan%5C%22%3A%7B%5C%22.section%5C%22%3A%5C%22dhcp%5C%22%2C%5C%22interface%5C%22%3A%5C%22lan%5C%22%2C%5C%22ignore%5C%22%3A%5C%220%5C%22%2C%5C%22leasetime%5C%22%3A%5C%2212h%5C%22%2C%5C%22range%5C%22%3A%5C%22172.16.0.100-172.16.0.200%5C%22%7D%7D%7D%7D%22%7D
  
  HTTP/1.1 200 OK
  Access-Control-Allow-Origin: *
  Status: 200 OK
  Content-Type: text/html; charset=utf-8
  Cache-Control: no-cache
  Expires: 0
  Transfer-Encoding: chunked
  Date: Thu, 01 Jan 1970 00:09:27 GMT
  Server: lighttpd/1.4.30
  
  31
  { &quot;ctx&quot;: &quot;No such command&quot;, &quot;exitStatus&quot;: false }
  0
  </code></pre>
  <p>NOTE: (6)</p>
  <h1>Successful example</h1>
  <p><a href="https://i.stack.imgur.com/ily9e.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ily9e.png" alt="Some of them are able to work" /></a></p>
  <p>Differences between them I have spotted (by differentiating header contents)</p>
  <p>Raw example (* Although path is different from the screen capture, both of them are unable to read post data)</p>
  <pre><code>POST https://192.168.0.7/cgi-bin/icul/;stok=92dea2b939b9fceb44ac84ac859de7f4/;stok=92dea2b939b9fceb44ac84ac859de7f4/remote_command HTTP/1.1
  Host: 192.168.0.7
  Connection: keep-alive
  Content-Length: 53
  Accept: application/json, text/javascript, */*; q=0.01
  Origin: https://192.168.0.7
  X-Requested-With: XMLHttpRequest
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
  Referer: https://192.168.0.7/cgi-bin/icul/;stok=92dea2b939b9fceb44ac84ac859de7f4/remote_command/command_reboot
  Accept-Encoding: gzip, deflate
  Accept-Language: en-US,en;q=0.8,zh-TW;q=0.6,zh;q=0.4
  Cookie: sysauth=683308794904e0bedaaead33acb15c7e
  
  command=command_reboot&amp;args=%7B%22--json%22%3Atrue%7D
  
  HTTP/1.1 200 OK
  Access-Control-Allow-Origin: *
  Status: 200 OK
  Content-Type: text/html; charset=utf-8
  Cache-Control: no-cache
  Expires: 0
  Transfer-Encoding: chunked
  Date: Thu, 01 Jan 1970 00:02:46 GMT
  Server: lighttpd/1.4.30
  
  34
  { &quot;ctx&quot;: &quot;\u0022success\u0022&quot;, &quot;exitStatus&quot;: true }
  0
  </code></pre>
  <p>NOTE: (6)</p>
  <h1>Header Difference between 2 examples</h1>
  <ul>
  <li><p>Successful one is using <a href="http://api.jquery.com/jquery.ajax/" rel="noreferrer">Jquery binding</a> while failure one using <a href="https://nodejs.org/api/http.html#http_http_request_options_callback" rel="noreferrer">HTTPS from nodejs</a> + browserify. However, I am still finding a way to check whether this is a problem or not (Not tested)</p>
  </li>
  <li><p>Missing <code>X-Requested-With: XMLHttpRequest</code>. However, adding this header back to the request does not fix this problem (Tested)</p>
  </li>
  <li><p>Capital header vs Smaller letter header field (</p>
  <ul>
  <li><p><code>content-type</code> and <code>Content-type</code>. However this difference is not the root cause for my problem as tried in <a href="http://jsfiddle.net/Uwcuz/4492/" rel="noreferrer">fiddle here</a> (Tested)</p>
  </li>
  <li><p><code>Accept</code> vs <code>accept</code> (Not tested)</p>
  </li>
  </ul>
  </li>
  </ul>
  <p>NOTE: (5) (7)</p>
  <p>Still, I am not sure why the first <code>c</code> in <code>content-type</code> is in small letter case.</p>
  <p>NOTE: (1)</p>
  <h1>What I have tried</h1>
  <p>I have tried on Firefox with firebug. It is able to show my payload. However, it cannot parse response from the server :'(</p>
  <p><s>Since the web server is running in HTTPS protocol, I cannot capture packets by wireshark. Any suggestion for debugging POST requests? Thanks.</s></p>
  <p>Link to a <a href="https://gist.github.com/mondwan/d8605fe5311ce13e9573" rel="noreferrer">gist</a> about debugging HTTP(s) request via command line. NOTE: (3)</p>
  <h1>Wrapper I am using</h1>
  <p>I have wrap <a href="https://nodejs.org/api/http.html#http_http_request_options_callback" rel="noreferrer">this method from nodejs</a> with a promise calls. Below is a snippet show an option I have used.</p>
  <pre><code>/**
   * Wraps HTTPS module from nodejs with Promise
   * @module common/http_request
   */
  
  var createRequestSetting = function (host, path, data, cookies) {
      return {
          method: 'POST',
          port:443,
          host: host,
          path: path,
          headers: {
              Accept: 'application/json, text/javascript, */*; q=0.01',
              'Content-Type':
                  'application/x-www-form-urlencoded; charset=UTF-8',
              'Content-Length': Buffer.byteLength(data),
              'Cookie': cookies,
          },
          rejectUnauthorized: false,
      };
  };
  </code></pre>
  <p><a href="http://jsfiddle.net/fpo8d5rv/" rel="noreferrer">Full source here</a></p>
  <p>NOTE: (2)</p>
  <h1>Update</h1>
  <ul>
  <li>(1) I have verified the letter <code>c</code> does not affect chrome debugger. Here is <a href="http://jsfiddle.net/Uwcuz/4492/" rel="noreferrer">the fiddle</a>. I have tried to mimic same request with <code>XMLHttpRequest</code> with letter <code>c</code>. I can still check form data in the debugger.</li>
  <li>(2) Link to the full source code</li>
  <li>(3) Link to a <a href="https://gist.github.com/mondwan/d8605fe5311ce13e9573" rel="noreferrer">gist from me</a> about scripts to test HTTP(s) request</li>
  <li>(4) Reformat the question for readability</li>
  <li>(5) Examples are not using the same binding after code reviewing</li>
  <li>(6) Add raw header example</li>
  <li>(7) Add a comparison session</li>
  </ul>