File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -1338,14 +1338,16 @@ example.js:
1338
1338
function preread_verify (s ) {
1339
1339
var collect = ' ' ;
1340
1340
1341
- s .on (' upload' , function (data , flags ) {
1341
+ s .on (' upload' , async function (data , flags ) {
1342
1342
collect += data;
1343
1343
1344
1344
if (collect .length >= 5 && collect .startsWith (' MAGiK' )) {
1345
1345
s .off (' upload' );
1346
- ngx .fetch (' http://127.0.0.1:8080/validate' ,
1347
- {body: collect .slice (5 ,7 ), headers: {Host: ' aaa' }})
1348
- .then (reply => (reply .status == 200 ) ? s .done (): s .deny ())
1346
+ let reply = ngx .fetch (' http://127.0.0.1:8080/validate' ,
1347
+ {body: collect .slice (5 ,7 ),
1348
+ headers: {Host: ' aaa' }});
1349
+
1350
+ (reply .status == 200 ) ? s .done (): s .deny ();
1349
1351
1350
1352
} else if (collect .length ) {
1351
1353
s .deny ();
Original file line number Diff line number Diff line change 1
1
function preread_verify ( s ) {
2
2
var collect = '' ;
3
3
4
- s . on ( 'upload' , function ( data , flags ) {
4
+ s . on ( 'upload' , async function ( data , flags ) {
5
5
collect += data ;
6
6
7
7
if ( collect . length >= 5 && collect . startsWith ( 'MAGiK' ) ) {
8
8
s . off ( 'upload' ) ;
9
- ngx . fetch ( 'http://127.0.0.1:8080/validate' ,
10
- { body : collect . slice ( 5 , 7 ) , headers : { Host :'aaa' } } )
11
- . then ( reply => ( reply . status == 200 ) ? s . done ( ) : s . deny ( ) )
9
+
10
+ let reply = await ngx . fetch ( 'http://127.0.0.1:8080/validate' ,
11
+ { body : collect . slice ( 5 , 7 ) ,
12
+ headers : { Host :'aaa' } } ) ;
13
+
14
+ ( reply . status == 200 ) ? s . done ( ) : s . deny ( ) ;
12
15
13
16
} else if ( collect . length ) {
14
17
s . deny ( ) ;
You can’t perform that action at this time.
0 commit comments