diff --git a/example/.swerve/get_user.lua b/example/.swerve/get_user.lua index fd91f9f9c36eea4a447524d7ebc4425e737c6fef..b3d66f06d037f99bced4dc535d5e06faf8f57751 100644 --- a/example/.swerve/get_user.lua +++ b/example/.swerve/get_user.lua @@ -3,10 +3,18 @@ print("We're going to the races"); foo = 1 + 1; r = empty_response(); -r:set_status(404); --- r:set_header("foo", "bar"); --- r:set_body() +r:set_status(200); +r:set_header("X-Powered-By", "Swerve"); +r:set_header("Content-Type", "text/plain"); +r:set_body("This is my only response"); -return response(200, "application/json", json_encode({ foo = 123 })); +--return r + +r = response(200, "application/json", json_encode({ foo = 123 })); + +r:unset_body(); +r:set_status(204); + +return r -- return response(200, "application/json", '{ "foo": ' .. foo .. ' }') \ No newline at end of file diff --git a/example/index.html b/example/index.html index 080c0fc49cfb6a8e4ab7847645034944714928e4..17d3d1e83a8c1ef03047ad1550c73cb1985f44ee 100644 --- a/example/index.html +++ b/example/index.html @@ -8,6 +8,7 @@ <body> <h1>It's Swervin' Time</h1> <p>This page is part of the swerve example, and includes a stylesheet and stuff.</p> + <img src="/files/adorable-puppy.jpg"> <script async src="js/say_hello.js"></script> </body> </html> \ No newline at end of file