AddRequestBuilder() публичный Метод

public AddRequestBuilder ( DelegatingRequestBuilder requestBuilder ) : void
requestBuilder Hapikit.RequestBuilders.DelegatingRequestBuilder
Результат void
Пример #1
0
        public void SettingAnAcceptHeaderShouldBePassedToTheRequest()
        {
            var link = new Link
            {
                Target = new Uri("Http://localhost"),
                
            };
            link.AddRequestBuilder(new InlineRequestBuilder((r) =>
            {
                r.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/vnd.hal"));
                r.Headers.UserAgent.Add(new ProductInfoHeaderValue("foo", "1.1"));
                return r;
            }));


            var request = link.CreateRequest();

            Assert.True(request.Headers.Accept.Any(h => h.MediaType == "application/vnd.hal"));
        }