comparison xml/en/docs/njs/reference.xml @ 2546:6093e9f3615e

Documented rawHeadersIn and rawHeadersOut in njs.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 19 May 2020 15:05:49 +0100
parents dca5a7053a6c
children 428a8cf1911b
comparison
equal deleted inserted replaced
2545:dca5a7053a6c 2546:6093e9f3615e
166 <tag-name><literal>r.remoteAddress</literal></tag-name> 166 <tag-name><literal>r.remoteAddress</literal></tag-name>
167 <tag-desc> 167 <tag-desc>
168 client address, read-only 168 client address, read-only
169 </tag-desc> 169 </tag-desc>
170 170
171 <tag-name id="r_raw_headers_in"><literal>r.rawHeadersIn{}</literal></tag-name>
172 <tag-desc>
173 returns an array of key-value pairs
174 exactly as they were received from the client
175 (<link doc="changes.xml" id="njs0.4.1">0.4.1</link>).
176 <para>
177 For example, with the following request headers:
178 <example>
179 Host: localhost
180 Foo: bar
181 foo: bar2
182 </example>
183 the output of <literal>r.rawHeadersIn</literal> will be:
184 <example>
185 [
186 ['Host', 'localhost'],
187 ['Foo', 'bar'],
188 ['foo', 'bar2']
189 ]
190 </example>
191 All <literal>foo</literal> headers
192 can be collected with the syntax:
193 <example>
194 r.rawHeadersIn.filter(v=>v[0].toLowerCase() == 'foo').map(v=>v[1])
195 </example>
196 the output will be:
197 <example>
198 ['bar', 'bar2']
199 </example>
200 Header field names are not converted to lower case,
201 duplicate field values are not merged.
202 </para>
203 </tag-desc>
204
205 <tag-name id="r_raw_headers_out"><literal>r.rawHeadersOut{}</literal></tag-name>
206 <tag-desc>
207 returns an array of key-value pairs of response headers
208 (<link doc="changes.xml" id="njs0.4.1">0.4.1</link>).
209 Header field names are not converted to lower case,
210 duplicate field values are not merged.
211 </tag-desc>
212
171 <tag-name id="r_request_body"><literal>r.requestBody</literal></tag-name> 213 <tag-name id="r_request_body"><literal>r.requestBody</literal></tag-name>
172 <tag-desc> 214 <tag-desc>
173 returns the client request body if it has not been 215 returns the client request body if it has not been
174 written to a temporary file. 216 written to a temporary file.
175 To ensure that the client request body is in memory, 217 To ensure that the client request body is in memory,