コード例 #1
0
        protected Task <FluentResponse> SendRequest(Action <SendBuilder> configure)
        {
            var request = _client.CreateRequest();
            var builder = new SendBuilder(request);

            configure(builder);

            if (request.ContentData != null && !(request.ContentData is HttpContent))
            {
                string mediaType = !String.IsNullOrEmpty(request.ContentType) ? request.ContentType : "application/json";
                request.ContentData = new StringContent(_serializer.SerializeToString(request.ContentData), Encoding.UTF8, mediaType);
            }

            return(_client.SendAsync(request));
        }
コード例 #2
0
        protected Task <FluentResponse> SendRequest(Action <SendBuilder> configure)
        {
            var request = _client.CreateRequest();
            var builder = new SendBuilder(request);

            configure(builder);

            if (request.ContentData != null && request.ContentData.GetType() != typeof(string))
            {
                request.ContentData = _serializer.SerializeToString(request.ContentData);
                if (!String.IsNullOrEmpty(request.ContentType))
                {
                    request.ContentType = "application/json";
                }
            }

            return(_client.SendAsync(request));
        }