Created
September 28, 2018 11:45
-
-
Save billchurch/6db9f3df272afe70f95219af031a89d5 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
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' | |
const request = require('request') | |
const url = makeurl(4094) | |
request('https://192.168.20.46/' + url, function (error, response, body) { | |
console.log('error:', error) // Print the error if one occurred | |
console.log('statusCode:', response && response.statusCode) // Print the response status code if a response was received | |
console.log('body:', body) // Print the HTML for the Google homepage. | |
}) | |
// return a "random" string of _num_ chars | |
function makeurl (num) { | |
let text = '' | |
let chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' | |
for (let i = 0; i < num; i++) { text += chars.charAt(Math.floor(Math.random() * chars.length)) } | |
return text | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
create a http request to a url with a "random" string of chars at a specified length.
modify line 5 above to the amount of characters you want in the URL
modify line 7 above to the desired URL