1

I have a problem with my GET request. ESP8266 with NodeMCU. My code in Arduino:

String cmd = "conn:send(\"GET /json.htm?type=command&param=udevice&idx=2&nvalue=0&svalue=11 HTTP/1.1\r\nHost: 192.168.0.101\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n\")";
wifi.println("conn=nil");
wifi.println("conn=net.createConnection(net.TCP, 0)");
wifi.println("conn:on(\"receive\", function(conn, payload) print(payload) end)");
wifi.println("conn:connect(8080, \"192.168.0.101\")");
wifi.println(cmd);

Error:

")stdin:1: unfinished string near '"GET /json.htm?type=command&param=udevice&idx=2&nvalue=0&svalue=11 HTTP/1.1Host: 192'

Doesn't Lua see \r\n in GET requests?

1 Answer 1

2

You might need to use double \\ instead, depending on where you are using it (Send box for example).

And since you are using \" to escape the quotes, \\n should probably do it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.