protected override void Validate(object[] args)
        {
            ResourceCommand.ValidateResourceArgs(args);

            if (args.Length != 1)
            {
                throw new ArgumentException("Resource can only have one argument");
            }
        }
示例#2
0
        private static Uri ParseUri(string httpMethod, string currentUri, object[] args)
        {
            if (args.Length > 0 && httpMethod.IsImmutableVerb())
            {
                ResourceCommand.ValidateResourceArgs(args);
                currentUri += "/" + args[0];
            }

            if (currentUri.EndsWith("/"))
            {
                currentUri = currentUri.TrimEnd("/".ToCharArray());
            }

            if (!Uri.TryCreate(currentUri, UriKind.Absolute, out var uri))
            {
                throw new ArgumentException($"{currentUri} is not a valid Absolute Uri");
            }

            return(uri);
        }