예제 #1
0
        protected RequestInfo MakeRequest(string method, string handler, string mediaType, string body = null)
        {
            var headers = new HeaderCollection {
                ContentType = mediaType
            };

            if (body != null)
            {
                headers.ContentLength = body.Length;
            }

            headers.Accept = mediaType;
            return(new RequestInfo(
                       Verb.Parse(method),
                       (HttpUrl)BaseUrl.AddSegment(handler),
                       (body != null ? new MemoryStream(Encoding.UTF8.GetBytes(body)) : new MemoryStream()),
                       new BasicClaimBasedIdentity(),
                       headers));
        }
예제 #2
0
 public void should_add_segment_correctly()
 {
     _url.AddSegment("you").AddSegment("imagine").ToString().Should().Be("http://temp.uri/whatever/path/you/imagine?with=query#and-fragment");
 }