Example #1
0
        public static HttpResponseMessage Get(this IdentityServerHost host, string path)
        {
            if (!path.StartsWith("http"))
            {
                path = host.Url.EnsureTrailingSlash() + path;
            }

            var result = host.Client.GetAsync(path).Result;

            host.ProcessCookies(result);

            return(result);
        }
Example #2
0
        public static HttpResponseMessage PostForm(this IdentityServerHost host, string path, object value, AntiForgeryTokenViewModel xsrf = null)
        {
            if (!path.StartsWith("http"))
            {
                path = host.Url.EnsureTrailingSlash() + path;
            }

            var form    = Map(value, xsrf);
            var body    = ToFormBody(form);
            var content = new StringContent(body, Encoding.UTF8, FormUrlEncodedMediaTypeFormatter.DefaultMediaType.MediaType);

            var response = host.Client.PostAsync(path, content).Result;

            host.ProcessCookies(response);

            return(response);
        }