-
-
Save tianlangwu/b5bc815ec97d0b979ab417b153bfa0cf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/urlRequest/urlRequest.js b/urlRequest/urlRequest.js | |
index bcb5268..6dc3fb0 100644 | |
--- a/urlRequest/urlRequest.js | |
+++ b/urlRequest/urlRequest.js | |
@@ -45,8 +45,19 @@ const checkUrls = (urls, json, status) => { | |
); | |
}; | |
+const checkTelescope = () => { | |
+ request("http://localhost:3000/posts", function (error, response, body){ | |
+ let obj = JSON.parse(body); | |
+ for (let i = 0; i < 10; i++){ | |
+ let url = "http://localhost:3000" + obj[i].url; | |
+ sendRequest(url); | |
+ } | |
+ }); | |
+} | |
+ | |
module.exports = | |
{ | |
sendRequest, | |
- checkUrls | |
+ checkUrls, | |
+ checkTelescope | |
} | |
\ No newline at end of file | |
diff --git a/urlstatuschecker.js b/urlstatuschecker.js | |
index 8ad6013..32a8235 100644 | |
--- a/urlstatuschecker.js | |
+++ b/urlstatuschecker.js | |
@@ -2,6 +2,7 @@ | |
const checkFiltertedUrls = require("./readers/filterUrlReader.js") | |
const pjson = require('./package.json'); | |
const MyFile = require("./readers/fileReader.js"); | |
+const urlRequest = require("./urlRequest/urlRequest.js"); | |
const argv = require('optimist').argv; | |
async function run() { | |
@@ -21,6 +22,9 @@ async function run() { | |
else if (process.argv.length == 3) { | |
if (process.argv[2] == "v" || process.argv[2] == "version" || argv.version || argv.v || argv.Version || argv.V || argv.VERSION) | |
console.log("UrlStatusChecker version " + pjson.version); | |
+ else if(process.argv[2] == "telescope"){ | |
+ urlRequest.checkTelescope(); | |
+ } | |
else myFile.readFile(process.argv[2]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment