Skip to content

Commit c001435

Browse files
committed
Refactor Angular2 API to use httpClientApiNode for HttpClient method calls
1 parent 7c9edff commit c001435

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

javascript/ql/lib/semmle/javascript/frameworks/Angular2.qll

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,16 @@ module Angular2 {
190190
result.hasUnderlyingType("@angular/common/http", "HttpClient")
191191
}
192192

193+
/** Gets a reference to an `HttpClient` object using the API graph. */
194+
API::Node httpClientApiNode() { result = API::Node::ofType("@angular/common/http", "HttpClient") }
195+
193196
private class AngularClientRequest extends ClientRequest::Range, DataFlow::MethodCallNode {
194197
int argumentOffset;
195198

196199
AngularClientRequest() {
197-
this = httpClient().getAMethodCall("request") and argumentOffset = 1
200+
this = httpClientApiNode().getMember("request").getACall() and argumentOffset = 1
198201
or
199-
this = httpClient().getAMethodCall() and
202+
this = httpClientApiNode().getAMember().getACall() and
200203
not this.getMethodName() = "request" and
201204
argumentOffset = 0
202205
}

0 commit comments

Comments
 (0)