diff --git a/docs/examples.rst b/docs/examples.rst index befd552..433b66c 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -1,10 +1,10 @@ -Simple file serving +Simple Test ------------------- -Serving the content of index.html from the filesystem. +Serving a simple static text message. -.. literalinclude:: ../examples/httpserver_simple_serve.py - :caption: examples/httpserver_simple_serve.py +.. literalinclude:: ../examples/httpserver_simpletest.py + :caption: examples/httpserver_simpletest.py :linenos: If you want your code to do more than just serve web pages, diff --git a/examples/httpserver_simple_serve.py b/examples/httpserver_simpletest.py similarity index 78% rename from examples/httpserver_simple_serve.py rename to examples/httpserver_simpletest.py index 226d8f2..c04ce2d 100644 --- a/examples/httpserver_simple_serve.py +++ b/examples/httpserver_simpletest.py @@ -27,10 +27,11 @@ @server.route("/") def base(request: HTTPRequest): """ - Serve the default index.html file. + Serve a default static plain text message. """ - with HTTPResponse(request, content_type=MIMEType.TYPE_HTML) as response: - response.send_file("index.html") + with HTTPResponse(request, content_type=MIMEType.TYPE_TXT) as response: + message = "Hello from the CircuitPython HTTPServer!" + response.send(message) print(f"Listening on http://{wifi.radio.ipv4_address}:80")