Skip to content

Instantly share code, notes, and snippets.

@billchurch
Created September 28, 2018 11:45
Show Gist options
  • Save billchurch/6db9f3df272afe70f95219af031a89d5 to your computer and use it in GitHub Desktop.
Save billchurch/6db9f3df272afe70f95219af031a89d5 to your computer and use it in GitHub Desktop.
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
}
@billchurch
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment