From 91a2cae575400a9fa28d1fd3bdd861fbfad1a41a Mon Sep 17 00:00:00 2001 From: Alessandro Ghedini Date: Mon, 19 Dec 2011 12:19:53 +0100 Subject: [PATCH] also update the status example --- eg/example-status.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eg/example-status.c b/eg/example-status.c index 7e91252..3c8985f 100644 --- a/eg/example-status.c +++ b/eg/example-status.c @@ -3,6 +3,14 @@ tofu_rep_t *handler(tofu_req_t *req) { tofu_rep_t *rep = tofu_rep_init(); + tofu_status(rep, 418); + + return rep; +} + +tofu_rep_t *error_418(tofu_req_t *req) { + tofu_rep_t *rep = tofu_rep_init(); + tofu_status(rep, 418); tofu_head(rep, "Content-Type", "text/html"); tofu_write(rep, "\nI'm a teapot

418 - Sorry, I'm just a teapot!

\n"); @@ -16,6 +24,8 @@ int main() { tofu_handle_with(ctx, GET, "/coffee", handler); + tofu_rescue_with(ctx, 418, error_418); + tofu_loop(ctx); tofu_ctx_free(ctx);