http - get method - It does not send pairs name-value



  • Hi,
    I am an accredited rookie ;-)

    When I try to send data through http, with the get method, it doesn't send the names and values pairs.

    UIflow with blocks:
    0_1580587604450_fba0daa1-709d-44d3-90cb-a8c1c9a73f2f-image.png

    When I look at the code, I don't see it send the string with the name and value pair.
    0_1580587570327_24d07e1c-3e64-4456-ac06-7f9982fede37-image.png

    According to this web page, the program would have to send you the data arguments.
    https://makeblock-micropython-api.readthedocs.io/en/latest/public_library/Third-party-libraries/urequests.html#urequests.request
    I have tried to write by hand, without success.

    Have any of the readers succeeded, send data to a server via http?

    This is the server code, written for node js, in case you want to try it at: https://repl.it/ o en https://glitch.com/

    var http = require('http');
    var url = require('url');
    
    var x_gyr = 0.0;
    
    /* https://echo-data-get-method-http-get.mariomoreno2020.repl.run/t.htm?x=15 */
    
    http.createServer(function (req, res) {
      // Set CORS headers
    	res.setHeader('Access-Control-Allow-Origin', '*');
    	res.setHeader('Access-Control-Request-Method', '*');
    	res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET, POST, PUT');
    	res.setHeader('Access-Control-Allow-Headers', '*');
      res.statusCode = 200;
      //
      res.writeHead(200, {'Content-Type': 'text/html'});
      var q = url.parse(req.url, true);
      console.log(q.href);
      if (q.pathname == '/t.html') {
        q = q.query;
        x_gyr = q.x;
      }   
      var txt = 'x= ' + x_gyr;
      res.end(txt);
    }).listen(8080);
    

    Remember that the http block, the url is 'http' instead of 'https'.

    And if you want to try the UIFlow code, here is a download link. You can see how in the blocks it sends data and in the python code no.
    https://mega.nz/#!YY82UIrB!fskiB3YAn1hQH6rCcbwzjiuJO5-Fz0H4LBr6LZ4WtjI