File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
lib/semmle/javascript/frameworks
test/library-tests/frameworks/ClientRequests Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -437,7 +437,14 @@ module ClientRequest {
437
437
result = this .getArgument ( 0 ) and
438
438
not exists ( this .getOptionArgument ( 1 , "baseUrl" ) )
439
439
or
440
- // Handle URL when passed as options
440
+ // Handle URL from options passed to extend()
441
+ exists ( API:: CallNode extendCall |
442
+ extendCall = API:: moduleImport ( "got" ) .getMember ( "extend" ) .getACall ( ) and
443
+ result = extendCall .getParameter ( 0 ) .getMember ( "url" ) .asSink ( ) and
444
+ not exists ( this .getArgument ( 0 ) )
445
+ )
446
+ or
447
+ // Handle URL from options passed as third argument when first arg is undefined/missing
441
448
exists ( API:: InvokeNode optionsCall |
442
449
optionsCall = API:: moduleImport ( "got" ) .getMember ( "Options" ) .getAnInvocation ( ) and
443
450
optionsCall .getReturn ( ) .getAValueReachableFromSource ( ) = this .getAnArgument ( ) and
Original file line number Diff line number Diff line change @@ -263,6 +263,12 @@ test_getUrl
263
263
| tst.js:328:5:328:38 | got(und ... ptions) | tst.js:328:9:328:17 | undefined |
264
264
| tst.js:329:5:329:45 | got(und ... {url})) | tst.js:329:9:329:17 | undefined |
265
265
| tst.js:329:5:329:45 | got(und ... {url})) | tst.js:329:40:329:42 | url |
266
+ | tst.js:332:5:332:46 | got.ext ... ).get() | tst.js:336:41:336:43 | url |
267
+ | tst.js:332:5:332:46 | got.ext ... ).get() | tst.js:339:42:339:44 | url |
268
+ | tst.js:337:5:337:20 | jsonClient.get() | tst.js:336:41:336:43 | url |
269
+ | tst.js:337:5:337:20 | jsonClient.get() | tst.js:339:42:339:44 | url |
270
+ | tst.js:340:5:340:21 | jsonClient2.get() | tst.js:336:41:336:43 | url |
271
+ | tst.js:340:5:340:21 | jsonClient2.get() | tst.js:339:42:339:44 | url |
266
272
test_getAResponseDataNode
267
273
| axiosTest.js:4:5:7:6 | axios({ ... \\n }) | axiosTest.js:4:5:7:6 | axios({ ... \\n }) | json | true |
268
274
| axiosTest.js:12:5:17:6 | axios({ ... \\n }) | axiosTest.js:12:5:17:6 | axios({ ... \\n }) | json | true |
Original file line number Diff line number Diff line change @@ -329,13 +329,13 @@ function gotTests(url){
329
329
got ( undefined , undefined , Options ( { url} ) ) ;
330
330
331
331
const options2 = new Options ( { url} ) ;
332
- got . extend ( options2 ) . extend ( options ) . get ( ) ; // call flagged not the actual url flow
332
+ got . extend ( options2 ) . extend ( options ) . get ( ) ;
333
333
334
334
got . paginate ( url , { } ) ; // not flagged
335
335
336
336
const jsonClient = got . extend ( { url : url } ) ;
337
- jsonClient . get ( ) ; // call flagged not the actual url flow
337
+ jsonClient . get ( ) ;
338
338
339
339
const jsonClient2 = got . extend ( { url : url } ) . extend ( { url : url } ) ;
340
- jsonClient2 . get ( ) ; // call flagged not the actual url flow
340
+ jsonClient2 . get ( ) ;
341
341
}
You can’t perform that action at this time.
0 commit comments