mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Manage chain calls of extend.
This commit is contained in:
@@ -414,13 +414,21 @@ module ClientRequest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a reference to an instance of the `got` library, including instances
|
||||
* created through chained `extend` calls.
|
||||
*/
|
||||
private API::Node getAGotInstance() {
|
||||
result = [API::moduleImport("got"), getAGotInstance().getMember("extend").getReturn()]
|
||||
}
|
||||
|
||||
/**
|
||||
* A model of a URL request made using the `got` library.
|
||||
*/
|
||||
class GotUrlRequest extends ClientRequest::Range {
|
||||
GotUrlRequest() {
|
||||
exists(API::Node callee, API::Node got | this = callee.getACall() |
|
||||
got = [API::moduleImport("got"), API::moduleImport("got").getMember("extend").getReturn()] and
|
||||
got = getAGotInstance() and
|
||||
callee = [got, got.getMember(["stream", "get", "post", "put", "patch", "head", "delete"])]
|
||||
)
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ function gotTests(url){
|
||||
got(undefined, undefined, Options({url})); // undefined is flagged, but should be url from options
|
||||
|
||||
const options2 = new Options({url});
|
||||
got.extend(options2).extend(options).get(); // not flagged
|
||||
got.extend(options2).extend(options).get(); // call flagged not the actual url flow
|
||||
|
||||
got.paginate(url, {}); // not flagged
|
||||
|
||||
@@ -337,5 +337,5 @@ function gotTests(url){
|
||||
jsonClient.get(); // call flagged not the actual url flow
|
||||
|
||||
const jsonClient2 = got.extend({url: url}).extend({url: url});
|
||||
jsonClient2.get(); // not flagged
|
||||
jsonClient2.get(); // call flagged not the actual url flow
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user