コード例 #1
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            IEnumerable <KeyValuePair <string, string> > sendParameter = this.parameters;

            if (request.Method == HttpMethod.Post && request.Content is FormUrlEncodedContent)
            {
                IEnumerable <KeyValuePair <string, string> > queryString = Utility.ParseQueryString(await request.Content.ReadAsStringAsync().ConfigureAwait(false), true);
                sendParameter   = sendParameter.Concat <KeyValuePair <string, string> >(queryString);
                request.Content = (HttpContent) new OAuthMessageHandler.FormUrlEncodedContentEx(queryString);
            }
            request.Headers.Authorization = new AuthenticationHeaderValue("OAuth", OAuthUtility.BuildBasicParameters(this.consumerKey, this.consumerSecret, request.RequestUri.OriginalString, request.Method, this.token, sendParameter).Concat <KeyValuePair <string, string> >(this.parameters).Select <KeyValuePair <string, string>, string>((Func <KeyValuePair <string, string>, string>)(p => p.Key + "=" + p.Value.Wrap("\""))).ToString <string>(","));
            return(await base.SendAsync(request, cancellationToken).ConfigureAwait(false));
        }
コード例 #2
0
        protected override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            IEnumerable <KeyValuePair <string, string> > enumerable = this.parameters;

            if (request.Method == HttpMethod.Post && request.Content is FormUrlEncodedContent)
            {
                IEnumerable <KeyValuePair <string, string> > enumerable2 = Utility.ParseQueryString(await request.Content.ReadAsStringAsync().ConfigureAwait(false), true);
                enumerable      = Enumerable.Concat <KeyValuePair <string, string> >(enumerable, enumerable2);
                request.Content = new OAuthMessageHandler.FormUrlEncodedContentEx(enumerable2);
            }
            IEnumerable <KeyValuePair <string, string> > arg_16E_0 = Enumerable.Concat <KeyValuePair <string, string> >(OAuthUtility.BuildBasicParameters(this.consumerKey, this.consumerSecret, request.RequestUri.OriginalString, request.Method, this.token, enumerable), this.parameters);
            Func <KeyValuePair <string, string>, string> arg_16E_1 = new Func <KeyValuePair <string, string>, string>((p) => { return(p.Key + "=" + p.Value.Wrap("\"")); });

            string parameter = Enumerable.Select <KeyValuePair <string, string>, string>(arg_16E_0, arg_16E_1).ToString(",");

            request.Headers.Authorization = new AuthenticationHeaderValue("OAuth", parameter);
            return(await base.SendAsync(request, cancellationToken).ConfigureAwait(false));
        }