webmcp
annotate framework/env/request/add_header.lua @ 262:c3d539e33710
Replaced request.add_initializer(...) and request.add_variable(...) with request.for_each(...) and request.configure(...) which both execute the passed function once in any case when being called
| author | jbe |
|---|---|
| date | Tue Mar 17 11:42:34 2015 +0100 (2015-03-17) |
| parents | 2169a62e12f5 |
| children | fa3a5bba0067 |
| rev | line source |
|---|---|
| jbe@221 | 1 function request.add_header(key, value) |
| jbe@254 | 2 if value == nil then |
| jbe@254 | 3 error("Function request.add_header(...) requires two arguments") |
| jbe@254 | 4 end |
| jbe@262 | 5 request.configure(function() |
| jbe@262 | 6 local headers = request._response_headers |
| jbe@262 | 7 headers[#headers+1] = {key, value} |
| jbe@262 | 8 end) |
| jbe@221 | 9 end |