@@ -89,11 +89,6 @@ http {
89
89
location /property {
90
90
js_content test.property;
91
91
}
92
- }
93
-
94
- server {
95
- listen 127.0.0.1:8080;
96
- server_name aaa;
97
92
98
93
location /loc {
99
94
js_content test.loc;
@@ -102,18 +97,9 @@ http {
102
97
location /json { }
103
98
}
104
99
105
- server {
106
- listen 127.0.0.1:8080;
107
- server_name bbb;
108
-
109
- location /loc {
110
- js_content test.loc;
111
- }
112
- }
113
-
114
100
server {
115
101
listen 127.0.0.1:8081;
116
- server_name ccc ;
102
+ server_name localhost ;
117
103
118
104
location /loc {
119
105
js_content test.loc;
@@ -150,14 +136,14 @@ $t->write_file('test.js', <<EOF);
150
136
return JSON.stringify(retval);
151
137
}
152
138
153
- ngx.fetch(`http://127.0.0.1:$p0 /\$ {loc}`, {headers: {Host: 'aaa'}} )
139
+ ngx.fetch(`http://127.0.0.1:$p0 /\$ {loc}`)
154
140
.then(reply => reply[getter]())
155
141
.then(data => r.return(200, query(data)))
156
142
.catch(e => r.return(501, e.message))
157
143
}
158
144
159
145
function property(r) {
160
- var opts = {headers:{Host: 'aaa' }};
146
+ var opts = {headers:{}};
161
147
162
148
if (r.args.code) {
163
149
opts.headers.code = r.args.code;
@@ -218,8 +204,8 @@ $t->write_file('test.js', <<EOF);
218
204
function chain(r) {
219
205
var results = [];
220
206
var reqs = [
221
- ['http://127.0.0.1:$p0 /loc', {headers: {Host:'aaa'}} ],
222
- ['http://127.0.0.1:$p0 /loc', {headers: {Host:'bbb'}} ],
207
+ ['http://127.0.0.1:$p0 /loc'],
208
+ ['http://127.0.0.1:$p1 /loc'],
223
209
];
224
210
225
211
function next(reply) {
@@ -317,16 +303,16 @@ $t->write_file('test.js', <<EOF);
317
303
var tests = [
318
304
[
319
305
'http://127.0.0.1:$p0 /loc',
320
- { headers: {Code: 201, Host: 'aaa' }},
306
+ { headers: {Code: 201}},
321
307
],
322
308
[
323
309
'http://127.0.0.1:$p0 /loc',
324
- { method:'POST', headers: {Code: 401, Host: 'bbb' }, body: 'OK'},
310
+ { method:'POST', headers: {Code: 401}, body: 'OK'},
325
311
],
326
312
[
327
313
'http://127.0.0.1:$p1 /loc',
328
314
{ method:'PATCH',
329
- headers: {foo:undefined, bar:'xxx', Host: 'ccc '}},
315
+ headers: {bar:'xxx'}},
330
316
],
331
317
];
332
318
@@ -366,10 +352,9 @@ $t->write_file('test.js', <<EOF);
366
352
function loc(r) {
367
353
var v = r.variables;
368
354
var body = str(r.requestText);
369
- var foo = str(r.headersIn.foo);
370
355
var bar = str(r.headersIn.bar);
371
356
var c = r.headersIn.code ? Number(r.headersIn.code) : 200;
372
- r.return(c, `\$ {v.host}: \$ {v. request_method}: \$ {foo }:\$ {bar}:\$ {body}`);
357
+ r.return(c, `\$ {v.request_method}:\$ {bar}:\$ {body}`);
373
358
}
374
359
375
360
export default {njs: test_njs, body, broken, broken_response, body_special,
@@ -383,9 +368,9 @@ $t->waitforsocket('127.0.0.1:' . port(8082));
383
368
384
369
# ##############################################################################
385
370
386
- like(http_get(' /body?getter=arrayBuffer&loc=loc' ), qr / 200 OK.*"aaa: GET: ::"$ / s ,
371
+ like(http_get(' /body?getter=arrayBuffer&loc=loc' ), qr / 200 OK.*"GET::"$ / s ,
387
372
' fetch body arrayBuffer' );
388
- like(http_get(' /body?getter=text&loc=loc' ), qr / 200 OK.*"aaa: GET: ::"$ / s ,
373
+ like(http_get(' /body?getter=text&loc=loc' ), qr / 200 OK.*"GET::"$ / s ,
389
374
' fetch body text' );
390
375
like(http_get(' /body?getter=json&loc=json&path=b.c' ),
391
376
qr / 200 OK.*"FIELD"$ / s , ' fetch body json' );
@@ -428,9 +413,9 @@ like(http_get('/header?loc=duplicate_header&h=buz&method=has'),
428
413
like(http_get(' /header?loc=chunked/big&h=BAR&readBody=1' ), qr / 200 OK.*xxx$ / s ,
429
414
' fetch chunked header' );
430
415
is(get_json(' /multi' ),
431
- ' [{"b":"aaa: GET: ::","c":201,"u":"http://127.0.0.1:' .$p0 .' /loc"},' .
432
- ' {"b":"bbb:POST:::OK ","c":401 ,"u":"http://127.0.0.1:' .$p0 .' /loc"},' .
433
- ' {"b":"ccc:PATCH::xxx: ","c":200 ,"u":"http://127.0.0.1:' .$p1 .' /loc"}]' ,
416
+ ' [{"b":"GET::","c":201,"u":"http://127.0.0.1:' .$p0 .' /loc"},' .
417
+ ' {"b":"PATCH:xxx: ","c":200 ,"u":"http://127.0.0.1:' .$p1 .' /loc"},' .
418
+ ' {"b":"POST::OK ","c":401 ,"u":"http://127.0.0.1:' .$p0 .' /loc"}]' ,
434
419
' fetch multi' );
435
420
like(http_get(' /multi?throw=1' ), qr / 500/ s , ' fetch destructor' );
436
421
is(get_json(' /broken' ),
0 commit comments