How to get post parameters from http request in lua sent to NodeMCU

前端 未结 2 1233
余生分开走
余生分开走 2021-01-28 05:24

I sent this HTTP POST request via Tasker (Android app) to my NodeMCU, which looks like this:

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded
User         


        
2条回答
  •  广开言路
    2021-01-28 06:02

    For the sake of completeness, here is another solution I came up with:

    string.gsub(request, "<(%a+)>([^<]+)", function(key, val)
      print(key .. ": " .. val)
    end)
    

    A working example using the given HTTP request in your question can be seen here:

    https://repl.it/repls/GlamorousAnnualConferences

提交回复
热议问题