Ejemplo n.º 1
0
        private Uri GetUri(IDictionary <string, object> param)
        {
            if (this.m_method == "GET")
            {
                var ub = new UriBuilder(this.m_url)
                {
                    Query = OauthHelper.ToQuery(param, false)
                };

                ub.Path = OauthHelper.NamedFormat(NamedFormat, param);

                return(ub.Uri);
            }
            else
            {
                return(new Uri(this.m_url));
            }
        }
Ejemplo n.º 2
0
        internal virtual WebRequest GetRequest(OAuth oauth)
        {
            var param = this.GetParameters();

            var req = oauth.CreateWebRequest(this.m_method, this.GetUri(param), param);

            if (this.m_method == "POST" && this.m_autoRequest)
            {
                var postData = OauthHelper.ToQuery(param, true);
                var buff     = Encoding.UTF8.GetBytes(postData);

                if (buff.Length > 0)
                {
                    req.ContentType = "application/x-www-form-urlencoded";
                    req.GetRequestStream().Write(buff, 0, buff.Length);
                }
            }

            return(req);
        }