dont imply required websocket fix #830
This commit is contained in:
parent
2587483bbe
commit
e57671ba9b
|
@ -72,11 +72,10 @@ addMethod(string, 'ws', function (schemas, msg = 'invalid websocket') {
|
|||
name: 'ws',
|
||||
message: msg,
|
||||
test: value => {
|
||||
if (!value) return true
|
||||
if (typeof value === 'undefined') return true
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
new URL(value)
|
||||
return true
|
||||
const url = new URL(value)
|
||||
return url.protocol === 'ws:' || url.protocol === 'wss:'
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue