Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 687534e

Browse files
committed
JS: Address review comments
1 parent 41bdd8a commit 687534e

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

javascript/ql/src/semmle/javascript/frameworks/ClientRequests.qll

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class ClientRequest extends DataFlow::InvokeNode {
5353
* - Any of the following additional response types defined by this library:
5454
* - `fetch.response`: The result is a `Response` object from [fetch](https://developer.mozilla.org/en-US/docs/Web/API/Response).
5555
* - `stream`: The result is a Node.js stream and `http.IncomingMessage` object
56-
* - `header`: The result the value of a header, as a string
56+
* - `header`: The result is the value of a header, as a string
5757
* - `headers`: The result is a mapping from header names to their values.
5858
* - `error`: The result is an error in an unspecified format, possibly containing information from the response
5959
* - An empty string, indicating an unknown response type.
@@ -106,7 +106,7 @@ module ClientRequest {
106106
}
107107

108108
/**
109-
* Gets name of an HTTP request method, in all-lowercase.
109+
* Gets the name of an HTTP request method, in all-lowercase.
110110
*/
111111
private string httpMethodName() { result = any(HTTP::RequestMethodName m).toLowerCase() }
112112

@@ -339,17 +339,13 @@ module ClientRequest {
339339

340340
override DataFlow::Node getAResponseDataNode(string responseType, boolean promise) {
341341
result = this and
342-
(
343-
isStream() and
342+
if isStream() then (
344343
responseType = "stream" and
345344
promise = false
346-
or
347-
isJson() and
345+
) else if isJson() then (
348346
responseType = "json" and
349347
promise = true
350-
or
351-
not isStream() and
352-
not isJson() and
348+
) else (
353349
responseType = "text" and
354350
promise = true
355351
)
@@ -495,8 +491,7 @@ module ClientRequest {
495491
override DataFlow::Node getHost() { none() }
496492

497493
override DataFlow::Node getADataNode() {
498-
result = getArgument(2) or
499-
result = getArgument(3)
494+
result = getArgument([2 .. 3])
500495
}
501496

502497
/** Gets an event listener with `this` bound to this object. */
@@ -526,7 +521,7 @@ module ClientRequest {
526521
}
527522

528523
/**
529-
* Gets the response type corresponding `getReponse()` but not
524+
* Gets the response type corresponding to `getReponse()` but not
530525
* for explicitly typed calls like `getResponseJson()`.
531526
*/
532527
string getAssignedResponseType() {

0 commit comments

Comments
 (0)