webmcp
changeset 456:59a6f4851764
Added request.get_header{...} function
author | jbe |
---|---|
date | Mon Jul 25 22:27:17 2016 +0200 (2016-07-25) |
parents | e2389cc82214 |
children | 17a2b7e1c463 |
files | framework/env/request/get_header.lua |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/request/get_header.lua Mon Jul 25 22:27:17 2016 +0200 1.3 @@ -0,0 +1,13 @@ 1.4 +--[[-- 1.5 +value = -- value of header as string containing comma (and space) separated values 1.6 +request.get_header( 1.7 + key -- name of header, e.g. "Authorization" 1.8 +) 1.9 + 1.10 +Returns the value of an HTTP header sent by the client. If the header occurs multiple times, the values are concatenated with a comma and zero or more space characters (e.g. "value1, value2"). 1.11 + 1.12 +--]]-- 1.13 + 1.14 +function request.get_header(key) 1.15 + return request._http_request.headers_csv_string[key] 1.16 +end