Add URL object generators to make.network
This commit is contained in:
parent
b9c6fa0e42
commit
272a6b614c
1 changed files with 18 additions and 0 deletions
|
@ -77,6 +77,24 @@ make.network = {
|
|||
'2001:db8::1:1:1:1:1'
|
||||
]
|
||||
},
|
||||
'hostname': function () {
|
||||
return random.pick([this.randomIPv4, this.randomIPv6, this.goodHostnames, this.badHostnames])
|
||||
},
|
||||
'port': function () {
|
||||
return random.pick([80, 443, 21, 23, 9310])
|
||||
},
|
||||
'hash': function () {
|
||||
return random.pick(['', '#', '#main-content', function () { return '#' + make.text.any() }])
|
||||
},
|
||||
'path': function () {
|
||||
return random.pick(['', '/', '/index.html', function () { return '/' + make.text.any() }])
|
||||
},
|
||||
'protocol': function () {
|
||||
return random.pick(['http:', 'https:', 'ftp:', 'telnet:', 'chrome:', 'resource:'])
|
||||
},
|
||||
'search': function () {
|
||||
return random.pick(['', '?', '?foo=bar', function () { return '?' + make.text.any() }])
|
||||
},
|
||||
randomBitmask: function (list) {
|
||||
if (list.length <= 1) {
|
||||
return list.join('')
|
||||
|
|
Loading…
Reference in a new issue