fix: Validate that base_url is well-formed

Fixes #221
spectre-console-remove-di-hacks
Robert Dailey 5 months ago
parent a341c9f173
commit 5731b3e14b

@ -14,6 +14,8 @@ public class ServiceConfigYamlValidator : AbstractValidator<ServiceConfigYaml>
.NotEmpty()
.Must(x => x!.StartsWith("http"))
.WithMessage("{PropertyName} must start with 'http' or 'https'")
.Must(uri => Uri.TryCreate(uri, UriKind.Absolute, out _))
.WithMessage("{PropertyName} must be a valid URL")
.WithName("base_url");
RuleFor(x => x.ApiKey)

Loading…
Cancel
Save