comparison js_fetch.t @ 1814:1d88487eafbf

Tests: added js tests for Fetch API objects. In addition, due to the fact that Headers.prototype.keys() now returns sorted header names one js_fetch.t test became broken. To fix it without introducing version check the test was changed so headers received from upstream are already sorted.
author Dmitry Volyntsev <xeioex@nginx.com>
date Tue, 13 Dec 2022 08:50:42 -0800
parents 0a489a9abc7a
children
comparison
equal deleted inserted replaced
1813:0a489a9abc7a 1814:1d88487eafbf
419 'fetch type'); 419 'fetch type');
420 like(http_get('/header?loc=duplicate_header&h=BAR'), qr/200 OK.*c$/s, 420 like(http_get('/header?loc=duplicate_header&h=BAR'), qr/200 OK.*c$/s,
421 'fetch header'); 421 'fetch header');
422 like(http_get('/header?loc=duplicate_header&h=BARR'), qr/200 OK.*null$/s, 422 like(http_get('/header?loc=duplicate_header&h=BARR'), qr/200 OK.*null$/s,
423 'fetch no header'); 423 'fetch no header');
424 like(http_get('/header?loc=duplicate_header&h=foo'), qr/200 OK.*a,b$/s, 424 like(http_get('/header?loc=duplicate_header&h=foo'), qr/200 OK.*a, ?b$/s,
425 'fetch header duplicate'); 425 'fetch header duplicate');
426 like(http_get('/header?loc=duplicate_header&h=BAR&method=getAll'), 426 like(http_get('/header?loc=duplicate_header&h=BAR&method=getAll'),
427 qr/200 OK.*\['c']$/s, 'fetch getAll header'); 427 qr/200 OK.*\['c']$/s, 'fetch getAll header');
428 like(http_get('/header?loc=duplicate_header&h=BARR&method=getAll'), 428 like(http_get('/header?loc=duplicate_header&h=BARR&method=getAll'),
429 qr/200 OK.*\[]$/s, 'fetch getAll no header'); 429 qr/200 OK.*\[]$/s, 'fetch getAll no header');
450 TODO: { 450 TODO: {
451 todo_skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE} 451 todo_skip 'leaves coredump', 1 unless $ENV{TEST_NGINX_UNSAFE}
452 or has_version('0.7.4'); 452 or has_version('0.7.4');
453 453
454 like(http_get('/header_iter?loc=duplicate_header_large'), 454 like(http_get('/header_iter?loc=duplicate_header_large'),
455 qr/\['A:a','B:a','C:a','D:a','E:a','F:a','G:a','H:a','Foo:a,b']$/s, 455 qr/\['A:a','B:a','C:a','D:a','E:a','F:a','G:a','H:a','Moo:a, ?b']$/s,
456 'fetch header duplicate large'); 456 'fetch header duplicate large');
457 457
458 } 458 }
459 459
460 TODO: { 460 TODO: {
577 "D: a" . CRLF . 577 "D: a" . CRLF .
578 "E: a" . CRLF . 578 "E: a" . CRLF .
579 "F: a" . CRLF . 579 "F: a" . CRLF .
580 "G: a" . CRLF . 580 "G: a" . CRLF .
581 "H: a" . CRLF . 581 "H: a" . CRLF .
582 "Foo: a" . CRLF . 582 "Moo: a" . CRLF .
583 "Foo: b" . CRLF . 583 "Moo: b" . CRLF .
584 "Connection: close" . CRLF . 584 "Connection: close" . CRLF .
585 CRLF; 585 CRLF;
586 586
587 } elsif ($uri eq '/headers') { 587 } elsif ($uri eq '/headers') {
588 print $client 588 print $client