Debug output in http/https get

Posted on
  • I'm not sure if this is the usual output. I can't recall seeing this in the past - the httpCRq object is dumped.

    Perhaps related to @opichals socket changes?

    make clean && RELEASE=1 make
    ./espurino
    
    var http = require("http");
    http.get("https://www.google.com", function(res) {
      res.on('data', function(data) {
        console.log(data);
      });
    });
    
    =httpCRq { "type": 5,
      "#onconnect": function (res) { ... },
      "res": httpCRs {  },
      "opt": {
        "protocol": "https:",
        "method": "GET",
        "host": "http://www.google.com",
        "path": "/",
        "pathname": "/",
        "search": null, "port": null, "query": null },
      "dSnd": "GET / HTTP/1.1\r\nU" ... "ww.google.com\r\n\r\n",
      "sckt": 4 }
    <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
    <TITLE>302 Moved</TITLE></HEAD><BO
    DY>
    <H1>302 Moved</H1>
    The document has moved
    <A HREF="https://www.google.co.nz/?gfe_rd=c­r&amp;dcr=0&amp;ei=aTgyWs_3F4rr8we175iYA­Q">here</A>.
    </BODY></HTML>
    
  • Did you copy&paste that into the console? If so I think that's what you'd expect - since the result of http.get will be a http request object, which gets printed with =.

  • Ah - yes into the left side of the ide.

    Thanks for the explanation!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Debug output in http/https get

Posted by Avatar for Wilberforce @Wilberforce

Actions