comparison js.t @ 1627:456bf219d768

Tests: adapted js buffer tests to renaming body properties.
author Dmitry Volyntsev <xeioex@nginx.com>
date Fri, 27 Nov 2020 13:10:55 +0000
parents a35445ae8de7
children 18ac4d9e5a2a
comparison
equal deleted inserted replaced
1626:a35445ae8de7 1627:456bf219d768
210 } 210 }
211 211
212 function request_body_cache(r) { 212 function request_body_cache(r) {
213 function t(v) {return Buffer.isBuffer(v) ? 'buffer' : (typeof v);} 213 function t(v) {return Buffer.isBuffer(v) ? 'buffer' : (typeof v);}
214 r.return(200, 214 r.return(200,
215 `requestBody:\${t(r.requestBody)} reqBody:\${t(r.reqBody)}`); 215 `requestText:\${t(r.requestText)} requestBuffer:\${t(r.requestBuffer)}`);
216 } 216 }
217 217
218 function send(r) { 218 function send(r) {
219 var a, s; 219 var a, s;
220 r.status = 200; 220 r.status = 200;
260 function content_empty(r) { 260 function content_empty(r) {
261 } 261 }
262 262
263 EOF 263 EOF
264 264
265 $t->try_run('no njs available')->plan(32); 265 $t->try_run('no njs available')->plan(33);
266 266
267 ############################################################################### 267 ###############################################################################
268 268
269 like(http_get('/method'), qr/method=GET/, 'r.method'); 269 like(http_get('/method'), qr/method=GET/, 'r.method');
270 like(http_get('/version'), qr/version=1.0/, 'r.httpVersion'); 270 like(http_get('/version'), qr/version=1.0/, 'r.httpVersion');
310 like(http_get('/type?path=rawVariables.host'), qr/200 OK.*type: buffer$/s, 310 like(http_get('/type?path=rawVariables.host'), qr/200 OK.*type: buffer$/s,
311 'rawVariables type'); 311 'rawVariables type');
312 312
313 like(http_post('/type?path=requestBody'), qr/200 OK.*type: string$/s, 313 like(http_post('/type?path=requestBody'), qr/200 OK.*type: string$/s,
314 'requestBody type'); 314 'requestBody type');
315 like(http_post('/type?path=reqBody'), qr/200 OK.*type: buffer$/s, 315 like(http_post('/type?path=requestText'), qr/200 OK.*type: string$/s,
316 'reqBody type'); 316 'requestText type');
317 like(http_post('/request_body_cache'), qr/requestBody:string reqBody:buffer$/s, 317 like(http_post('/type?path=requestBuffer'), qr/200 OK.*type: buffer$/s,
318 'reqBody type'); 318 'requestBuffer type');
319 like(http_post('/request_body_cache'),
320 qr/requestText:string requestBuffer:buffer$/s, 'request body cache');
319 321
320 } 322 }
321 323
322 like(http_get('/var'), qr/variable=127.0.0.1/, 'r.variables'); 324 like(http_get('/var'), qr/variable=127.0.0.1/, 'r.variables');
323 like(http_get('/global'), qr/global=njs/, 'global code'); 325 like(http_get('/global'), qr/global=njs/, 'global code');