Mercurial > hg > nginx-tests
comparison js.t @ 1438:98facc98bb2e
Tests: adapted js.t to set header changes in njs.
Empty value means no header.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Wed, 06 Feb 2019 20:19:00 +0300 |
parents | cace66c3ce56 |
children | 5d0eb718f38e |
comparison
equal
deleted
inserted
replaced
1437:2fc21bdd6f0d | 1438:98facc98bb2e |
---|---|
326 | 326 |
327 $t->try_run('no njs available')->plan(35); | 327 $t->try_run('no njs available')->plan(35); |
328 | 328 |
329 ############################################################################### | 329 ############################################################################### |
330 | 330 |
331 TODO: { | |
332 local $TODO = 'not yet' | |
333 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.2'; | |
334 | 331 |
335 like(http_get('/method'), qr/method=GET/, 'r.method'); | 332 like(http_get('/method'), qr/method=GET/, 'r.method'); |
336 like(http_get('/version'), qr/version=1.0/, 'r.httpVersion'); | 333 like(http_get('/version'), qr/version=1.0/, 'r.httpVersion'); |
337 like(http_get('/addr'), qr/addr=127.0.0.1/, 'r.remoteAddress'); | 334 like(http_get('/addr'), qr/addr=127.0.0.1/, 'r.remoteAddress'); |
338 like(http_get('/uri'), qr/uri=\/uri/, 'r.uri'); | 335 like(http_get('/uri'), qr/uri=\/uri/, 'r.uri'); |
345 like(http_get('/ctype'), qr/Content-Type: application\/foo/, | 342 like(http_get('/ctype'), qr/Content-Type: application\/foo/, |
346 'r.headersOut.contentType'); | 343 'r.headersOut.contentType'); |
347 like(http_get('/clen'), qr/Content-Length: 5/, 'r.headersOut.contentLength'); | 344 like(http_get('/clen'), qr/Content-Length: 5/, 'r.headersOut.contentLength'); |
348 like(http_get('/hdr_out?foo=12345'), qr/Foo: 12345/, 'r.headersOut'); | 345 like(http_get('/hdr_out?foo=12345'), qr/Foo: 12345/, 'r.headersOut'); |
349 like(http_get('/hdr_out?foo=123&bar=copy'), qr/Bar: 123/, 'r.headersOut get'); | 346 like(http_get('/hdr_out?foo=123&bar=copy'), qr/Bar: 123/, 'r.headersOut get'); |
350 like(http_get('/hdr_out?bar=empty'), qr/Bar: \x0d/, 'r.headersOut empty'); | |
351 like(http_get('/hdr_out?foo='), qr/Foo: \x0d/, 'r.headersOut no value'); | |
352 like(http_get('/hdr_out?foo'), qr/Foo: \x0d/, 'r.headersOut no value 2'); | |
353 like(http_get('/ihdr_out?a=12&b=34'), qr/^1234$/m, 'r.headersOut iteration'); | 347 like(http_get('/ihdr_out?a=12&b=34'), qr/^1234$/m, 'r.headersOut iteration'); |
354 like(http_get('/ihdr_out'), qr/\x0d\x0a?\x0d\x0a?$/m, 'r.send zero'); | 348 like(http_get('/ihdr_out'), qr/\x0d\x0a?\x0d\x0a?$/m, 'r.send zero'); |
349 | |
350 TODO: { | |
351 local $TODO = 'not yet' | |
352 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.8'; | |
353 | |
354 unlike(http_get('/hdr_out?bar=empty'), qr/Bar:/, 'r.headersOut empty'); | |
355 unlike(http_get('/hdr_out?foo='), qr/Foo:/, 'r.headersOut no value'); | |
356 unlike(http_get('/hdr_out?foo'), qr/Foo:/, 'r.headersOut no value 2'); | |
357 | |
358 } | |
355 | 359 |
356 like(http_post('/body'), qr/REQ-BODY/, 'request body'); | 360 like(http_post('/body'), qr/REQ-BODY/, 'request body'); |
357 like(http_post('/in_file'), qr/request body is in a file/, | 361 like(http_post('/in_file'), qr/request body is in a file/, |
358 'request body in file'); | 362 'request body in file'); |
359 like(http_post_big('/body'), qr/200.*^(1234567890){1024}$/ms, | 363 like(http_post_big('/body'), qr/200.*^(1234567890){1024}$/ms, |
380 http_get('/except'); | 384 http_get('/except'); |
381 http_get('/content_except'); | 385 http_get('/content_except'); |
382 | 386 |
383 like(http_get('/content_empty'), qr/500 Internal Server Error/, | 387 like(http_get('/content_empty'), qr/500 Internal Server Error/, |
384 'empty handler'); | 388 'empty handler'); |
385 } | |
386 | 389 |
387 $t->stop(); | 390 $t->stop(); |
388 | 391 |
389 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'log js'); | 392 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'log js'); |
390 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, | 393 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0, |