MCPcopy Create free account
hub / github.com/nodejs/node / getURLRecord

Function getURLRecord

deps/undici/undici.js:14969–14988  ·  view source on GitHub ↗
(url, baseURL)

Source from the content-addressed store, hash-verified

14967 }
14968 __name(isValidClientWindowBits, "isValidClientWindowBits");
14969 function getURLRecord(url, baseURL) {
14970 let urlRecord;
14971 try {
14972 urlRecord = new URL(url, baseURL);
14973 } catch (e) {
14974 throw new DOMException(e, "SyntaxError");
14975 }
14976 if (urlRecord.protocol === "http:") {
14977 urlRecord.protocol = "ws:";
14978 } else if (urlRecord.protocol === "https:") {
14979 urlRecord.protocol = "wss:";
14980 }
14981 if (urlRecord.protocol !== "ws:" && urlRecord.protocol !== "wss:") {
14982 throw new DOMException("expected a ws: or wss: url", "SyntaxError");
14983 }
14984 if (urlRecord.hash.length || urlRecord.href.endsWith("#")) {
14985 throw new DOMException("hash", "SyntaxError");
14986 }
14987 return urlRecord;
14988 }
14989 __name(getURLRecord, "getURLRecord");
14990 function validateCloseCodeAndReason(code, reason) {
14991 if (code !== null) {

Callers 1

constructorMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected