public OperationMetadata(UriModel uri, IMember returnType)
 {
     Uri = uri;
     DesiredReturnType = returnType;
     ResponseCodes     = new List <ResponseCode>();
     UriParser         = new UriParameterParser(Uri.Uri);
 }
        public void CanParsePathAndQueryParam()
        {
            var parser = new UriParameterParser("simple/{Name}?id={ID}");

            Assert.IsTrue(parser.HasPathParam("name"));
            Assert.IsTrue(parser.HasQueryParam("id"));
        }
        public void CanParseMultipleQueryParams()
        {
            var parser = new UriParameterParser("simple?name={Name}&something={someThing}");

            Assert.IsTrue(parser.HasQueryParam("name"));
            Assert.IsTrue(parser.HasQueryParam("something"));
        }
 public OperationMetadata(UriModel uri, IMember returnType)
 {
     Uri = uri;
     DesiredReturnType = returnType;
     ResponseCodes = new List<ResponseCode>();
     UriParser=new UriParameterParser(Uri.Uri);
 }
        public IHttpMethodImplementation GetImplementation(Request request)
        {
            // Determine whether the request URI is defined as route.
            var route = _routeFinder.FindRoute(request.Uri);

            if (route == null)
            {
                throw new HttpNotFoundException($"No route configured for URI '{request.RawUrl}'");
            }

            // Determine whether the HTTP method from the request is defined in the Route.
            var methodImplementation = _implementationFinder.FindImplementation(request, route);

            if (methodImplementation == null)
            {
                throw new HttpMethodNotAllowedException($"No Route configured for an HTTP {request.Method.ToString().ToUpper()} on URI '{request.RawUrl}'");
            }

            request.UriParameters = UriParameterParser.Parse(route.UriTemplate, request.Uri);

            return(methodImplementation);
        }
 public OperationMetadata(UriModel uri)
 {
     Uri = uri;
     ResponseCodes = new List<ResponseCode>();
     UriParser=new UriParameterParser(Uri.Uri);
 }
 public void CanParseQueryParam()
 {
     var parser = new UriParameterParser("simple?name={Name}");
     Assert.IsTrue(parser.HasQueryParam("name"));
 }
 public void CanParsePathAndQueryParam()
 {
     var parser = new UriParameterParser("simple/{Name}?id={ID}");
     Assert.IsTrue(parser.HasPathParam("name"));
     Assert.IsTrue(parser.HasQueryParam("id"));
 }
 public void CanParsePathParam()
 {
     var parser = new UriParameterParser("simple/{Name}");
     Assert.IsTrue(parser.HasPathParam("name"));
 }
 public void CanParseMultipleQueryParams()
 {
     var parser = new UriParameterParser("simple?name={Name}&something={someThing}");
     Assert.IsTrue(parser.HasQueryParam("name"));
     Assert.IsTrue(parser.HasQueryParam("something"));
 }
        public void CanParseQueryParam()
        {
            var parser = new UriParameterParser("simple?name={Name}");

            Assert.IsTrue(parser.HasQueryParam("name"));
        }
        public void CanParsePathParam()
        {
            var parser = new UriParameterParser("simple/{Name}");

            Assert.IsTrue(parser.HasPathParam("name"));
        }
示例#13
0
 public OperationMetadata(UriModel uri)
 {
     Uri           = uri;
     ResponseCodes = new List <ResponseCode>();
     UriParser     = new UriParameterParser(Uri.Uri);
 }