blob: e2eafe12fbcb09879731c76f52a271f0f5a267d4 [file] [log] [blame]
Willy Tarreaud4359fd2021-04-02 10:49:34 +02001-- http-response actions
2core.register_action("set-status-418-defaultreason", {"http-res"}, function(txn)
3 txn.http:res_set_status(418)
4end)
5core.register_action("set-status-418-customreason", {"http-res"}, function(txn)
6 txn.http:res_set_status(418, "I'm a coffeepot")
7end)
8
9-- http services
10core.register_service("http418-default", "http", function(applet)
11 local response = "Hello World !"
12 applet:set_status(418)
13 applet:add_header("content-length", string.len(response))
14 applet:add_header("content-type", "text/plain")
15 applet:start_response()
16 applet:send(response)
17end)
18
19core.register_service("http418-coffeepot", "http", function(applet)
20 local response = "Hello World !"
21 applet:set_status(418, "I'm a coffeepot")
22 applet:add_header("content-length", string.len(response))
23 applet:add_header("content-type", "text/plain")
24 applet:start_response()
25 applet:send(response)
26end)