public RequestHandler4 <T, TR, TU, Header> Header(string name)
 => new RequestHandler4 <T, TR, TU, Header>(
     Method,
     Path,
     ResolverParam1,
     ResolverParam2,
     ResolverParam3,
     ParameterResolver.Header(name),
     ErrorHandler,
     MediaTypeMapper);
Exemple #2
0
        public void Header()
        {
            var resolver = ParameterResolver.Header("Host");

            var result = resolver.Apply(_request, _mappedParameters);

            Assert.Equal("Host", result.Name);
            Assert.Equal("www.vlingo.io", result.Value);
            Assert.Equal(ParameterResolver.Type.Header, resolver.Type);
        }
        public void AddingHandlerHeader()
        {
            var hostHeader = RequestHeader.Of("Host", "www.vlingo.io");
            var request    = Request.Has(Method.Get)
                             .And("/user?filter=abc".ToMatchableUri())
                             .And(Headers.Of(hostHeader))
                             .And(Version.Http1_1);
            var mappedParameters =
                new Action.MappedParameters(1, Method.Get, "ignored", new List <Action.MappedParameter>());

            var handler = new RequestHandler0(Method.Get, "/user").Header("Host");

            AssertResolvesAreEquals(ParameterResolver.Header("Host"), handler.Resolver);
            Assert.Equal(hostHeader, handler.Resolver.Apply(request, mappedParameters));
        }
Exemple #4
0
        public void AddingHandlerHeader()
        {
            var hostHeader = RequestHeader.Of("Host", "www.vlingo.io");
            var request    = Request.Has(Method.Get)
                             .And("/user/admin".ToMatchableUri())
                             .And(Headers.Of(hostHeader))
                             .And(Version.Http1_1);
            var mappedParameters =
                new Action.MappedParameters(1, Method.Get, "ignored",
                                            Enumerable.Empty <Action.MappedParameter>().ToList());

            var handler = CreateRequestHandler(
                Method.Get,
                "/user/{userId}",
                ParameterResolver.Path <string>(0))
                          .Header("Host");

            AssertResolvesAreEquals(ParameterResolver.Header("Host"), handler.ResolverParam2);
            Assert.Equal(hostHeader, handler.ResolverParam2.Apply(request, mappedParameters));
        }
Exemple #5
0
        public void AddingHandlerHeader()
        {
            var hostHeader = RequestHeader.Of("Host", "www.vlingo.io");
            var request    = Request.Has(Method.Get)
                             .And("/posts/my-post/comment/my-comment".ToMatchableUri())
                             .And(Headers.Of(hostHeader))
                             .And(Version.Http1_1);
            var mappedParameters =
                new Action.MappedParameters(1, Method.Get, "ignored", Enumerable.Empty <Action.MappedParameter>().ToList());

            var handler = CreateRequestHandler(
                Method.Get,
                "/posts/{postId}/comment/{commentId}/votes/{votesNumber}",
                ParameterResolver.Path <string>(0),
                ParameterResolver.Path <string>(1),
                ParameterResolver.Path <string>(2),
                ParameterResolver.Query("page", 10)
                )
                          .Header("Host");

            AssertResolvesAreEquals(ParameterResolver.Header("Host"), handler.ResolverParam5);
            Assert.Equal(hostHeader, handler.ResolverParam5.Apply(request, mappedParameters));
        }
Exemple #6
0
 public RequestHandler1 <Header> Header(string name)
 => new RequestHandler1 <Header>(Method, Path, ParameterResolver.Header(name), ErrorHandler, MediaTypeMapper);
 public RequestHandler8 <T, TR, TU, TI, TJ, TK, TL, Header> Header(string name) =>
 new RequestHandler8 <T, TR, TU, TI, TJ, TK, TL, Header>(Method, Path, ResolverParam1, ResolverParam2, ResolverParam3, ResolverParam4, ResolverParam5, ResolverParam6, ResolverParam7,
                                                         ParameterResolver.Header(name),
                                                         ErrorHandler,
                                                         MediaTypeMapper);