Mercurial > hg > nginx-site
comparison xml/en/docs/njs/reference.xml @ 2532:423d813dc8bb
Documented support for multi-value headers in r.headersOut.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 23 Apr 2020 12:57:43 +0100 |
parents | 6ce28e0beec0 |
children | d6bbfd20c82f |
comparison
equal
deleted
inserted
replaced
2531:9c8a89d3876f | 2532:423d813dc8bb |
---|---|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> | 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
8 | 8 |
9 <article name="Reference" | 9 <article name="Reference" |
10 link="/en/docs/njs/reference.html" | 10 link="/en/docs/njs/reference.html" |
11 lang="en" | 11 lang="en" |
12 rev="38"> | 12 rev="39"> |
13 | 13 |
14 <section id="summary"> | 14 <section id="summary"> |
15 | 15 |
16 <para> | 16 <para> |
17 <link doc="index.xml">njs</link> provides objects, methods and properties | 17 <link doc="index.xml">njs</link> provides objects, methods and properties |
73 | 73 |
74 <tag-name id="r_headers_out"><literal>r.headersOut{}</literal></tag-name> | 74 <tag-name id="r_headers_out"><literal>r.headersOut{}</literal></tag-name> |
75 <tag-desc> | 75 <tag-desc> |
76 outgoing headers object, writable. | 76 outgoing headers object, writable. |
77 <para> | 77 <para> |
78 For example, the <literal>Foo</literal> header | 78 The <header>Foo</header> response header |
79 can be accessed with the syntax <literal>headersOut.foo</literal> | 79 can be accessed with the syntax: |
80 or <literal>headersOut['Foo']</literal> | 80 <literal>headersOut.foo</literal> or <literal>headersOut['Foo']</literal>. |
81 </para> | |
82 | |
83 <para> | |
84 Field values of multi-value response headers | |
85 (<link doc="changes.xml" id="njs0.4.0">0.4.0</link>) | |
86 can be set with the syntax: | |
87 <example> | |
88 r.headersOut[‘Foo’] = [‘a’, ‘b’] | |
89 </example> | |
90 where the output will be: | |
91 <example> | |
92 Foo: a | |
93 Foo: b | |
94 </example> | |
95 All previous field values of the <header>Foo</header> response header | |
96 will be deleted. | |
97 </para> | |
98 | |
99 <para> | |
100 For standard response headers | |
101 that accept only a single field value such as | |
102 <header>Content-Type</header>, | |
103 only the last element of the array will take effect. | |
104 Duplicate field values in | |
105 <header>Age</header>, | |
106 <header>Content-Encoding</header>, | |
107 <header>Content-Length</header>, | |
108 <header>Content-Type</header>, | |
109 <header>ETag</header>, | |
110 <header>Expires</header>, | |
111 <header>Last-Modified</header>, | |
112 <header>Location</header>, | |
113 <header>Retry-After</header> | |
114 response headers are ignored. | |
115 All other duplicate field values of the response header | |
116 are joined together with comma “<literal>,</literal>”. | |
117 Field values of the <header>Set-Cookie</header> response header | |
118 are always returned as an array. | |
81 </para> | 119 </para> |
82 </tag-desc> | 120 </tag-desc> |
83 | 121 |
84 <tag-name><literal>r.httpVersion</literal></tag-name> | 122 <tag-name><literal>r.httpVersion</literal></tag-name> |
85 <tag-desc> | 123 <tag-desc> |