MCPcopy Index your code
hub / github.com/nodejs/node / validateCloseCodeAndReason

Function validateCloseCodeAndReason

deps/undici/undici.js:14990–15002  ·  view source on GitHub ↗
(code, reason)

Source from the content-addressed store, hash-verified

14988 }
14989 __name(getURLRecord, "getURLRecord");
14990 function validateCloseCodeAndReason(code, reason) {
14991 if (code !== null) {
14992 if (code !== 1e3 && (code < 3e3 || code > 4999)) {
14993 throw new DOMException("invalid code", "InvalidAccessError");
14994 }
14995 }
14996 if (reason !== null) {
14997 const reasonBytesLength = Buffer.byteLength(reason);
14998 if (reasonBytesLength > 123) {
14999 throw new DOMException(`Reason must be less than 123 bytes; received ${reasonBytesLength}`, "SyntaxError");
15000 }
15001 }
15002 }
15003 __name(validateCloseCodeAndReason, "validateCloseCodeAndReason");
15004 var utf8Decode = (() => {
15005 if (typeof process.versions.icu === "string") {

Callers 1

closeWebSocketConnectionFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…