webmcp
annotate framework/env/request/set_status.lua @ 53:a1c77838c2e5
Documentation for "attr", "a_attr" and "form_attr" arguments to function ui.link{...}
author | jbe |
---|---|
date | Fri Jun 10 15:32:29 2011 +0200 (2011-06-10) |
parents | 9fdfb27f8e67 |
children |
rev | line source |
---|---|
jbe/bsw@0 | 1 --[[-- |
jbe/bsw@0 | 2 request.set_status( |
jbe/bsw@0 | 3 str -- string containing a HTTP status code, e.g. "404 Not Found" |
jbe/bsw@0 | 4 ) |
jbe/bsw@0 | 5 |
jbe/bsw@0 | 6 Calling this function causes a HTTP status different from 200 OK (or in case of error different from 500 Internal Server Error) to be sent to the browser. |
jbe/bsw@0 | 7 |
jbe/bsw@0 | 8 --]]-- |
jbe/bsw@0 | 9 |
jbe/bsw@0 | 10 function request.set_status(str) |
jbe/bsw@0 | 11 if str then |
jbe/bsw@0 | 12 local t = type(str) |
jbe/bsw@0 | 13 if type(str) == "number" then |
jbe/bsw@0 | 14 str = tostring(str) |
jbe/bsw@0 | 15 elseif type(str) ~= "string" then |
jbe/bsw@0 | 16 error("request.set_status(...) must be called with a string as parameter.") |
jbe/bsw@0 | 17 end |
jbe/bsw@0 | 18 request._status = str |
jbe/bsw@0 | 19 else |
jbe/bsw@0 | 20 request._status = nil |
jbe/bsw@0 | 21 end |
jbe/bsw@0 | 22 end |