annotate js2.t @ 1367:c6721d7bf1a0

Tests: skip mirror test with limit_req on win32, it hangs.
author Sergey Kandaurov <pluknet@nginx.com>
date Thu, 16 Aug 2018 14:16:10 +0300
parents 32156faf018e
children 215f3357034b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
1 #!/usr/bin/perl
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
2
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
3 # (C) Roman Arutyunyan
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
4 # (C) Dmitry Volyntsev
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
5 # (C) Nginx, Inc.
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
6
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
7 # Tests for http njs module.
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
8
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
9 ###############################################################################
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
10
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
11 use warnings;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
12 use strict;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
13
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
14 use Test::More;
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
15 use Socket qw/ CRLF /;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
16
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
17 BEGIN { use FindBin; chdir($FindBin::Bin); }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
18
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
19 use lib 'lib';
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
20 use Test::Nginx;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
21
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
22 ###############################################################################
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
23
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
24 select STDERR; $| = 1;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
25 select STDOUT; $| = 1;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
26
864
460a9cadbd2f Tests: do not check for njs presence, just try js.t configuration.
Sergey Kandaurov <pluknet@nginx.com>
parents: 709
diff changeset
27 my $t = Test::Nginx->new()->has(qw/http rewrite/)
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
28 ->write_file_expand('nginx.conf', <<'EOF');
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
29
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
30 %%TEST_GLOBALS%%
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
31
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
32 daemon off;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
33
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
34 events {
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
35 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
36
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
37 http {
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
38 %%TEST_GLOBALS_HTTP%%
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
39
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
40 js_set $test_method test_method;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
41 js_set $test_version test_version;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
42 js_set $test_addr test_addr;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
43 js_set $test_uri test_uri;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
44 js_set $test_hdr_in test_hdr_in;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
45 js_set $test_ihdr_in test_ihdr_in;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
46 js_set $test_arg test_arg;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
47 js_set $test_iarg test_iarg;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
48 js_set $test_var test_var;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
49 js_set $test_log test_log;
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
50 js_set $test_except test_except;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
51
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
52 js_include test.js;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
53
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
54 server {
974
882267679006 Tests: simplified parallel modifications in tests.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 952
diff changeset
55 listen 127.0.0.1:8080;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
56 server_name localhost;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
57
1333
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
58 location /njs {
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
59 js_content test_njs;
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
60 }
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
61
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
62 location /method {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
63 return 200 $test_method;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
64 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
65
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
66 location /version {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
67 return 200 $test_version;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
68 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
69
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
70 location /addr {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
71 return 200 $test_addr;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
72 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
73
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
74 location /uri {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
75 return 200 $test_uri;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
76 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
77
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
78 location /hdr_in {
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
79 return 200 $test_hdr_in;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
80 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
81
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
82 location /ihdr_in {
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
83 return 200 $test_ihdr_in;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
84 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
85
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
86 location /arg {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
87 return 200 $test_arg;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
88 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
89
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
90 location /iarg {
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
91 return 200 $test_iarg;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
92 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
93
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
94 location /var {
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
95 return 200 $test_var;
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
96 }
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
97
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
98 location /body {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
99 js_content request_body;
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
100 }
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
101
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
102 location /in_file {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
103 client_body_in_file_only on;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
104 js_content request_body;
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
105 }
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
106
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
107 location /status {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
108 js_content status;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
109 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
110
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
111 location /ctype {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
112 js_content ctype;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
113 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
114
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
115 location /clen {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
116 js_content clen;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
117 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
118
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
119 location /hdr_out {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
120 js_content hdr_out;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
121 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
122
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
123 location /ihdr_out {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
124 js_content ihdr_out;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
125 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
126
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
127 location /request_body {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
128 js_content request_body;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
129 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
130
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
131 location /send {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
132 js_content send;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
133 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
134
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
135 location /return_method {
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
136 js_content return_method;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
137 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
138
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
139 location /return_headers {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
140 js_content return_headers;
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
141 }
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
142
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
143 location /log {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
144 return 200 $test_log;
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
145 }
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
146
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
147 location /except {
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
148 return 200 $test_except;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
149 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
150
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
151 location /content_except {
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
152 js_content content_except;
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
153 }
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
154
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
155 location /content_empty {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
156 js_content content_empty;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
157 }
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
158 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
159 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
160
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
161 EOF
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
162
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
163 $t->write_file('test.js', <<EOF);
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
164 function test_njs(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
165 r.return(200, njs.version);
1333
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
166 }
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
167
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
168 function test_method(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
169 return 'method=' + r.method;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
170 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
171
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
172 function test_version(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
173 return 'version=' + r.httpVersion;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
174 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
175
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
176 function test_addr(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
177 return 'addr=' + r.remoteAddress;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
178 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
179
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
180 function test_uri(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
181 return 'uri=' + r.uri;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
182 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
183
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
184 function test_hdr_in(r) {
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
185 return 'hdr=' + r.headersIn.foo;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
186 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
187
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
188 function test_ihdr_in(r) {
1106
4b0b10e39a08 Tests: fixed implicitly declared njs variables after 4337ed48d6d6.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1001
diff changeset
189 var s = '', h;
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
190 for (h in r.headersIn) {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
191 if (h.substr(0, 3) == 'foo') {
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
192 s += r.headersIn[h];
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
193 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
194 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
195 return s;
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
196 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
197
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
198 function test_arg(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
199 return 'arg=' + r.args.foo;
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
200 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
201
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
202 function test_iarg(r) {
1106
4b0b10e39a08 Tests: fixed implicitly declared njs variables after 4337ed48d6d6.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1001
diff changeset
203 var s = '', a;
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
204 for (a in r.args) {
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
205 if (a.substr(0, 3) == 'foo') {
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
206 s += r.args[a];
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
207 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
208 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
209 return s;
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
210 }
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
211
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
212 function test_var(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
213 return 'variable=' + r.variables.remote_addr;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
214 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
215
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
216 function status(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
217 r.status = 204;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
218 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
219 r.finish();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
220 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
221
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
222 function ctype(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
223 r.status = 200;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
224 r.headersOut['Content-Type'] = 'application/foo';
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
225 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
226 r.finish();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
227 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
228
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
229 function clen(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
230 r.status = 200;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
231 r.headersOut['Content-Length'] = 5;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
232 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
233 r.send('foo12');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
234 r.finish();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
235 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
236
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
237 function hdr_out(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
238 r.status = 200;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
239 r.headersOut['Foo'] = r.args.fOO;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
240
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
241 if (r.args.bar) {
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
242 r.headersOut['Bar'] =
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
243 r.headersOut[(r.args.bar == 'empty' ? 'Baz' :'Foo')]
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
244 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
245
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
246 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
247 r.finish();
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
248 }
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
249
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
250 function ihdr_out(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
251 r.status = 200;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
252 r.headersOut['a'] = r.args.a;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
253 r.headersOut['b'] = r.args.b;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
254
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
255 var s = '', h;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
256 for (h in r.headersOut) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
257 s += r.headersOut[h];
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
258 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
259
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
260 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
261 r.send(s);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
262 r.finish();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
263 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
264
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
265 function request_body(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
266 try {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
267 var body = r.requestBody;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
268 r.return(200, body);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
269
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
270 } catch (e) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
271 r.return(500, e.message);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
272 }
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
273 }
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
274
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
275 function send(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
276 var a, s;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
277 r.status = 200;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
278 r.sendHeader();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
279 for (a in r.args) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
280 if (a.substr(0, 3) == 'foo') {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
281 s = r.args[a];
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
282 r.send('n=' + a + ', v=' + s.substr(0, 2) + ' ');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
283 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
284 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
285 r.finish();
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
286 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
287
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
288 function return_method(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
289 r.return(Number(r.args.c), r.args.t);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
290 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
291
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
292 function return_headers(r) {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
293 r.headersOut.Foo = 'bar';
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
294 r.return(200);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
295 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
296
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
297 function test_log(r) {
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
298 r.log('SEE-THIS');
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
299 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
300
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
301 function test_except(r) {
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
302 var fs = require('fs');
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
303 fs.readFileSync();
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
304 }
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
305
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
306
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
307 function content_except(r) {
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
308 JSON.parse({}.a.a);
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
309 }
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
310
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
311 function content_empty(r) {
1331
f48d2792730e Tests: added njs empty js_content handler test.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1315
diff changeset
312 }
f48d2792730e Tests: added njs empty js_content handler test.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1315
diff changeset
313
993
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
314 EOF
3ee5ca1ec728 Tests: updated js.t to the new http js module syntax.
Sergey Kandaurov <pluknet@nginx.com>
parents: 974
diff changeset
315
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
316 $t->try_run('no njs available')->plan(34);
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
317
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
318 ###############################################################################
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
319
1333
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
320 TODO: {
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
321 local $TODO = 'not yet'
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
322 unless http_get('/njs') =~ /^([.0-9]+)$/m && $1 ge '0.2.2';
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
323
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
324 like(http_get('/method'), qr/method=GET/, 'r.method');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
325 like(http_get('/version'), qr/version=1.0/, 'r.httpVersion');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
326 like(http_get('/addr'), qr/addr=127.0.0.1/, 'r.remoteAddress');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
327 like(http_get('/uri'), qr/uri=\/uri/, 'r.uri');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
328 like(http_get_hdr('/hdr_in'), qr/hdr=12345/, 'r.headersIn');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
329 like(http_get_ihdr('/ihdr_in'), qr/12345barz/, 'r.headersIn iteration');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
330 like(http_get('/arg?foO=12345'), qr/arg=12345/, 'r.args');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
331 like(http_get('/iarg?foo=12345&foo2=bar&nn=22&foo-3=z'), qr/12345barz/,
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
332 'r.args iteration');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
333 like(http_get('/status'), qr/204 No Content/, 'r.status');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
334 like(http_get('/ctype'), qr/Content-Type: application\/foo/,
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
335 'r.headersOut.contentType');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
336 like(http_get('/clen'), qr/Content-Length: 5/, 'r.headersOut.contentLength');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
337 like(http_get('/hdr_out?foo=12345'), qr/Foo: 12345/, 'r.headersOut');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
338 like(http_get('/hdr_out?foo=123&bar=copy'), qr/Bar: 123/, 'r.headersOut get');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
339 like(http_get('/hdr_out?bar=empty'), qr/Bar: \x0d/, 'r.headersOut empty');
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
340 like(http_get('/hdr_out?foo='), qr/Foo: \x0d/, 'r.headersOut no value');
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
341 like(http_get('/hdr_out?foo'), qr/Foo: \x0d/, 'r.headersOut no value 2');
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
342 like(http_get('/ihdr_out?a=12&b=34'), qr/^1234$/m, 'r.headersOut iteration');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
343 like(http_get('/ihdr_out'), qr/\x0d\x0a?\x0d\x0a?$/m, 'r.send zero');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
344
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
345 like(http_post('/body'), qr/REQ-BODY/, 'request body');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
346 like(http_post('/in_file'), qr/request body is in a file/,
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
347 'request body in file');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
348 like(http_post_big('/body'), qr/200.*^(1234567890){1024}$/ms,
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
349 'request body big');
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
350
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
351 like(http_get('/send?foo=12345&n=11&foo-2=bar&ndd=&foo-3=z'),
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
352 qr/n=foo, v=12 n=foo-2, v=ba n=foo-3, v=z/, 'r.send');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
353
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
354 like(http_get('/return_method?c=200'), qr/200 OK.*\x0d\x0a?\x0d\x0a?$/s,
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
355 'return code');
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
356 like(http_get('/return_method?c=200&t=SEE-THIS'), qr/200 OK.*^SEE-THIS$/ms,
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
357 'return text');
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
358 like(http_get('/return_method?c=301&t=path'), qr/ 301 .*Location: path/s,
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
359 'return redirect');
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
360 like(http_get('/return_method?c=404'), qr/404 Not.*html/s, 'return error page');
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
361 like(http_get('/return_method?c=inv'), qr/ 500 /, 'return invalid');
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
362
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
363 like(http_get('/return_headers'), qr/Foo: bar/, 'return headers');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
364
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
365 like(http_get('/var'), qr/variable=127.0.0.1/, 'r.variables');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
366 like(http_get('/log'), qr/200 OK/, 'r.log');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
367
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
368 http_get('/except');
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
369 http_get('/content_except');
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
370
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
371 like(http_get('/content_empty'), qr/500 Internal Server Error/,
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
372 'empty handler');
1333
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
373 }
746d9ffdbd26 Tests: fixed empty js_content test committed in f48d2792730e.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1331
diff changeset
374
1001
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
375 $t->stop();
4a0e1d7cc20b Tests: more JavaScript tests for http js module.
Sergey Kandaurov <pluknet@nginx.com>
parents: 994
diff changeset
376
1315
890516ca898a Tests: reverted 3882f8f3b2bc to unbreak with njs 0.1.15.
Sergey Kandaurov <pluknet@nginx.com>
parents: 1310
diff changeset
377 ok(index($t->read_file('error.log'), 'SEE-THIS') > 0, 'log js');
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
378 ok(index($t->read_file('error.log'), 'at fs.readFileSync') > 0,
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
379 'js_set backtrace');
1247
edf5a3c9e36a Tests: added tests for js backtraces.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1106
diff changeset
380 ok(index($t->read_file('error.log'), 'at JSON.parse') > 0,
1352
32156faf018e Tests: fine-tuning of js2.t.
Andrey Zelenkov <zelenkov@nginx.com>
parents: 1341
diff changeset
381 'js_content backtrace');
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
382
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
383 ###############################################################################
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
384
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
385 sub http_get_hdr {
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
386 my ($url, %extra) = @_;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
387 return http(<<EOF, %extra);
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
388 GET $url HTTP/1.0
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
389 FoO: 12345
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
390
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
391 EOF
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
392 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
393
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
394 sub http_get_ihdr {
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
395 my ($url, %extra) = @_;
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
396 return http(<<EOF, %extra);
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
397 GET $url HTTP/1.0
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
398 foo: 12345
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
399 Host: localhost
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
400 foo2: bar
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
401 X-xxx: more
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
402 foo-3: z
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
403
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
404 EOF
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
405 }
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
406
1341
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
407 sub http_post {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
408 my ($url, %extra) = @_;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
409
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
410 my $p = "POST $url HTTP/1.0" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
411 "Host: localhost" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
412 "Content-Length: 8" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
413 CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
414 "REQ-BODY";
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
415
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
416 return http($p, %extra);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
417 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
418
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
419 sub http_post_big {
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
420 my ($url, %extra) = @_;
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
421
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
422 my $p = "POST $url HTTP/1.0" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
423 "Host: localhost" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
424 "Content-Length: 10240" . CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
425 CRLF .
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
426 ("1234567890" x 1024);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
427
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
428 return http($p, %extra);
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
429 }
15f0d9412b22 Tests: for http njs module using the single req object API.
Dmitry Volyntsev <xeioex@nginx.com>
parents: 1336
diff changeset
430
708
71a2d58c0a7f Tests: JavaScript tests.
Roman Arutyunyan <arut@nginx.com>
parents:
diff changeset
431 ###############################################################################