webmcp

view framework/env/request/add_header.lua @ 382:810c020b0da4

Reverted changes to mondelefant_result_index and mondelefant_result_newindex C-functions (proxying of JSON document)
author jbe
date Mon Nov 16 18:31:49 2015 +0100 (2015-11-16)
parents fa3a5bba0067
children
line source
1 --[[--
2 request.add_header(
3 key, -- name of header, e.g. "Date"
4 value -- value, e.g. "Mon, 1 Jan 2001 01:00:00 GMT"
5 )
7 Adds a HTTP header to the response.
9 --]]--
11 function request.add_header(key, value)
12 if value == nil then
13 error("Function request.add_header(...) requires two arguments")
14 end
15 request.configure(function()
16 local headers = request._response_headers
17 headers[#headers+1] = {key, value}
18 local lower_key = string.lower(key)
19 if lower_key == "cache-control" then
20 request._cache_manual = true
21 end
22 end)
23 end

Impressum / About Us