ChobiQ.DoubanFMAPICodePack.ConnectionManager.GetPostResponseStream C# (CSharp) Method

GetPostResponseStream() public static method

public static GetPostResponseStream ( string requestUri, FormData data ) : Stream
requestUri string
data FormData
return Stream
        public static Stream GetPostResponseStream(string requestUri,
            FormData data)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(
                "https://www.douban.com" + requestUri);
            request.Method = "POST";
            request.ProtocolVersion = HttpVersion.Version11;

            request.Headers.Add("Origin", "onering://radio");
            request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) "
                + "AppleWebKit/535.19 "
                + "(KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19";

            request.ContentType = "application/x-www-form-urlencoded";
            request.Accept = "application/json, text/javascript, */*; q=0.01";
            request.KeepAlive = true;

            request.CookieContainer = s_cookies;

            using (StreamWriter writer = new StreamWriter(
                request.GetRequestStream()))
            {
                writer.Write(data.GetFormString());
                writer.Close();
            }

            return request.GetResponse().GetResponseStream();
        }