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',
|
name: 'ws',
|
||||||
message: msg,
|
message: msg,
|
||||||
test: value => {
|
test: value => {
|
||||||
if (!value) return true
|
if (typeof value === 'undefined') return true
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-new
|
const url = new URL(value)
|
||||||
new URL(value)
|
return url.protocol === 'ws:' || url.protocol === 'wss:'
|
||||||
return true
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue