From d5529846f2b27f9d63c2703e5b2bd3cba20e4fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20St=C3=B6r?= Date: Thu, 16 Jun 2016 08:40:50 +0200 Subject: [PATCH] Fix the HTTP server examples --- README.md | 2 +- docs/en/index.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36e270f2..227897f3 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ srv = net.createServer(net.TCP) srv:listen(80, function(conn) conn:on("receive", function(sck, payload) print(payload) - sck:send("

Hello, NodeMCU.

") + sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n

Hello, NodeMCU.

") end) conn:on("sent", function(sck) sck:close() end) end) diff --git a/docs/en/index.md b/docs/en/index.md index bc2e7ca1..c8731c50 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -11,11 +11,11 @@ The NodeMCU programming model is similar to that of [Node.js](https://en.wikiped -- a simple HTTP server srv = net.createServer(net.TCP) srv:listen(80, function(conn) - conn:on("receive", function(conn, payload) + conn:on("receive", function(sck, payload) print(payload) - conn:send("

Hello, NodeMCU.

") + sck:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n

Hello, NodeMCU.

") end) - conn:on("sent", function(conn) conn:close() end) + conn:on("sent", function(sck) sck:close() end) end) ``` ```lua