comparison js_fetch_objects.t @ 1854:0152ce2de27f

Tests: removed forbidden header js tests.
author Dmitry Volyntsev <xeioex@nginx.com>
date Wed, 10 May 2023 18:25:20 -0700
parents de6aeda5c274
children
comparison
equal deleted inserted replaced
1853:36a4563f7f00 1854:0152ce2de27f
156 156
157 }, 'OK'], 157 }, 'OK'],
158 ['invalid header value', () => { 158 ['invalid header value', () => {
159 var h = new Headers({A: 'aa\x00a'}); 159 var h = new Headers({A: 'aa\x00a'});
160 }, 'invalid header value'], 160 }, 'invalid header value'],
161 ['forbidden header', () => {
162 const forbidden = ['Host', 'Connection', 'Content-length'];
163 forbidden.forEach(fh => {
164 var headers = {};
165 headers[fh] = 'xxx';
166 headers.foo = 'bar';
167
168 var h = new Headers(headers);
169 if (h.get(fh) != 'xxx') {
170 throw new Error(`forbidden header \${fh}`);
171 }
172
173 if (h.get('foo') != 'bar') {
174 throw new Error(
175 `non forbidden header foo: \${h.get('foo')}`);
176 }
177 })
178
179 return 'OK';
180
181 }, 'OK'],
182 ['combine', () => { 161 ['combine', () => {
183 var h = new Headers({a: 'X', A: 'Z'}); 162 var h = new Headers({a: 'X', A: 'Z'});
184 return h.get('a'); 163 return h.get('a');
185 }, 'X, Z'], 164 }, 'X, Z'],
186 ['combine2', () => { 165 ['combine2', () => {
325 } 304 }
326 305
327 return 'OK'; 306 return 'OK';
328 307
329 }, 'OK'], 308 }, 'OK'],
330 ['forbidden request header', () => {
331 const forbidden = ['Host', 'Connection', 'Content-length'];
332 forbidden.forEach(fh => {
333 var r = new Request("http://nginx.org",
334 {headers: {[fh]: 'xxx', foo: 'bar'}});
335 if (r.headers.get(fh) != null) {
336 throw new Error(`forbidden header \${fh}`);
337 }
338
339 if (r.headers.get('foo') != 'bar') {
340 throw new Error(
341 `non forbidden header foo: \${r.headers.get('foo')}`);
342 }
343 })
344
345 return 'OK';
346
347 }, 'OK'],
348 ['method', () => { 309 ['method', () => {
349 const methods = ['get', 'hEad', 'Post', 'OPTIONS', 'PUT', 310 const methods = ['get', 'hEad', 'Post', 'OPTIONS', 'PUT',
350 'DELETE', 'CONNECT']; 311 'DELETE', 'CONNECT'];
351 try { 312 try {
352 methods.forEach(m => { 313 methods.forEach(m => {