From 4f6b6d12e09790331f8c04c825e1c2aabd45429f Mon Sep 17 00:00:00 2001 From: Asger F Date: Mon, 5 Aug 2019 11:47:51 +0100 Subject: [PATCH] JS: Test for 'request' package --- .../ClientRequests/ClientRequests.expected | 16 ++++++++++++++++ .../frameworks/ClientRequests/tst.js | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected b/javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected index 74a521c5f2b..df5606ca843 100644 --- a/javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected +++ b/javascript/ql/test/library-tests/frameworks/ClientRequests/ClientRequests.expected @@ -39,6 +39,9 @@ test_ClientRequest | tst.js:93:5:93:35 | net.req ... host }) | | tst.js:98:15:98:34 | new XMLHttpRequest() | | tst.js:106:16:106:35 | new XMLHttpRequest() | +| tst.js:117:5:121:6 | request ... \\n }) | +| tst.js:123:5:127:6 | request ... \\n }) | +| tst.js:129:5:129:37 | request ... true}) | test_getADataNode | tst.js:53:5:53:23 | axios({data: data}) | tst.js:53:18:53:21 | data | | tst.js:57:5:57:39 | axios.p ... data2}) | tst.js:57:19:57:23 | data1 | @@ -62,6 +65,9 @@ test_getADataNode | tst.js:80:15:80:34 | new XMLHttpRequest() | tst.js:82:14:82:17 | data | | tst.js:98:15:98:34 | new XMLHttpRequest() | tst.js:101:14:101:17 | data | | tst.js:106:16:106:35 | new XMLHttpRequest() | tst.js:108:15:108:18 | data | +| tst.js:117:5:121:6 | request ... \\n }) | tst.js:117:18:121:5 | functio ... ;\\n } | +| tst.js:123:5:127:6 | request ... \\n }) | tst.js:123:18:123:29 | {json: true} | +| tst.js:129:5:129:37 | request ... true}) | tst.js:129:25:129:36 | {json: true} | test_getHost | tst.js:87:5:87:39 | http.ge ... host}) | tst.js:87:34:87:37 | host | | tst.js:89:5:89:23 | axios({host: host}) | tst.js:89:18:89:21 | host | @@ -114,6 +120,9 @@ test_getUrl | tst.js:93:5:93:35 | net.req ... host }) | tst.js:93:17:93:34 | { hostname: host } | | tst.js:98:15:98:34 | new XMLHttpRequest() | tst.js:100:17:100:19 | url | | tst.js:106:16:106:35 | new XMLHttpRequest() | tst.js:107:18:107:20 | url | +| tst.js:117:5:121:6 | request ... \\n }) | tst.js:117:13:117:15 | url | +| tst.js:123:5:127:6 | request ... \\n }) | tst.js:123:13:123:15 | url | +| tst.js:129:5:129:37 | request ... true}) | tst.js:129:20:129:22 | url | test_getAResponseDataNode | tst.js:19:5:19:23 | requestPromise(url) | tst.js:19:5:19:23 | requestPromise(url) | text | true | | tst.js:21:5:21:23 | superagent.get(url) | tst.js:21:5:21:23 | superagent.get(url) | text | true | @@ -141,3 +150,10 @@ test_getAResponseDataNode | tst.js:106:16:106:35 | new XMLHttpRequest() | tst.js:110:9:110:25 | this.responseText | text | false | | tst.js:106:16:106:35 | new XMLHttpRequest() | tst.js:111:9:111:24 | this.responseXML | document | false | | tst.js:106:16:106:35 | new XMLHttpRequest() | tst.js:112:9:112:23 | this.statusText | text | false | +| tst.js:117:5:121:6 | request ... \\n }) | tst.js:117:28:117:32 | error | error | false | +| tst.js:117:5:121:6 | request ... \\n }) | tst.js:117:45:117:48 | body | text | false | +| tst.js:117:5:121:6 | request ... \\n }) | tst.js:119:9:119:21 | response.body | text | false | +| tst.js:123:5:127:6 | request ... \\n }) | tst.js:123:42:123:46 | error | error | false | +| tst.js:123:5:127:6 | request ... \\n }) | tst.js:123:59:123:62 | body | json | false | +| tst.js:123:5:127:6 | request ... \\n }) | tst.js:125:9:125:21 | response.body | json | false | +| tst.js:129:5:129:37 | request ... true}) | tst.js:129:5:129:37 | request ... true}) | json | true | diff --git a/javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js b/javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js index 989c845ba37..fd33daca33a 100644 --- a/javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js +++ b/javascript/ql/test/library-tests/frameworks/ClientRequests/tst.js @@ -112,3 +112,19 @@ import {ClientRequest, net} from 'electron'; this.statusText; }); }) + +(function() { + request(url, function (error, response, body) { + error; + response.body; + body; + }); + + request(url, {json: true}, function (error, response, body) { + error; + response.body; + body; + }); + + requestPromise(url, {json: true}); +});