Validates that a URL string uses HTTP or HTTPS protocol.
The URL string to validate
true if the URL is valid HTTP/HTTPS or falsy, false otherwise
Returns true for empty/falsy values to support nullable fields. This allows nullable URL value objects to pass validation when null/undefined.
isValidHttpUrl("https://example.com"); // trueisValidHttpUrl("http://example.com"); // trueisValidHttpUrl("ftp://example.com"); // falseisValidHttpUrl(""); // true (supports nullable) Copy
isValidHttpUrl("https://example.com"); // trueisValidHttpUrl("http://example.com"); // trueisValidHttpUrl("ftp://example.com"); // falseisValidHttpUrl(""); // true (supports nullable)
Validates that a URL string uses HTTP or HTTPS protocol.