ovidiucp / TinyWebServer

Small web server for Arduino, fits in 10KB ROM, less than 512 bytes RAM
http://www.webweavertech.com/ovidiu/weblog/archives/000484.html
GNU Lesser General Public License v2.1
245 stars 65 forks source link

Sometimes the webserver´s root show as plain/text #21

Open fg1998 opened 10 years ago

fg1998 commented 10 years ago

I believe there is an error where users request the server root (without a page ou another element in the URL). The server sends page as text/plain> and not text/html

I did make some changes in code to force server send response as text/html, as you can see in this code (I added the line web_server.send_content_type("text/html");) in code bellow

I Apologize if this isn't the correct way to send this suggestion, but this is my very, very first time in GitHub

boolean index_handler(TinyWebServer& web_server) { web_server.send_error_code(200); web_server.send_content_type("text/html"); web_server.end_headers(); web_server << F("Hello World!"); return true; }