Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function validateHttpEndpoint(isAnonymous,isFromTemplateEditor) {
if (!isAnonymous) {
if (isValidName('endpointName')) {
CARBON.showWarningDialog(jsi18n['name.field.should.be.valid']);
return false;
}
}
if (isEmptyField('url')) {
CARBON.showWarningDialog(jsi18n['address.field.cannot.be.empty']);
return false;
}
if (!isFromTemplateEditor) {
// check for a valid URL
var endpointURI = getElementValue('url');
if (endpointURI != null) {
if (!isValidURL(endpointURI)) {
CARBON.showWarningDialog(jsi18n['invalid.url.provided']);
return false;
}
}
var durationVal = getElementValue('suspendDuration');
if (durationVal != null) {
function validateAddressEndpoint(isAnonymous,isFromTemplateEditor) {
if (!isAnonymous) {
if (isValidName('endpointName')) {
CARBON.showWarningDialog(jsi18n['name.field.should.be.valid']);
return false;
}
}
if (hasKeyWord('endpointName')) {
CARBON.showErrorDialog(jsi18n['name.field.cannot.be.keyword']);
return false;
}
if (isEmptyField('url')) {
CARBON.showWarningDialog(jsi18n['address.field.cannot.be.empty']);
return false;
}
if (!isFromTemplateEditor) {
// check for a valid URL
var endpointURI = getElementValue('url');
if (endpointURI != null) {
if (!isValidURL(endpointURI)) {
CARBON.showWarningDialog(jsi18n['invalid.url.provided']);
return false;
}
}
var durationVal = getElementValue('suspendDuration');
if (durationVal != null) {