6bd7317d6abed1cac6291a2af938e9db4210f592
[project/uhttpd.git] / examples / ucode / dump-env.uc
1 Status: 200 OK
2 Content-Type: text/html
3
4 <h1>Headers</h1>
5
6 {% for (let k, v in env.headers): %}
7 <strong>{{ replace(k, /(^|-)(.)/g, (m0, d, c) => d + uc(c)) }}</strong>: {{ v }}<br>
8 {% endfor %}
9
10 <h1>Environment</h1>
11
12 {% for (let k, v in env): if (type(v) == 'string'): %}
13 <code>{{ k }}={{ v }}</code><br>
14 {% endif; endfor %}
15
16 {% if (env.CONTENT_LENGTH > 0): %}
17 <h1>Body Contents</h1>
18
19 {% for (let chunk = uhttpd.recv(64); chunk != null; chunk = uhttpd.recv(64)): %}
20 <code>{{ replace(chunk, /[^[:graph:]]/g, '.') }}</code><br>
21 {% endfor %}
22 {% endif %}