コード例 #1
0
        /// <summary>
        /// Adds form data file to the inner <see cref="HttpRequestMessage" />.
        /// </summary>
        /// <param name="request">The <see cref="ISolidHttpRequest" /> that is being extended.</param>
        /// <param name="name">The form name of the file.</param>
        /// <param name="content">The file <see cref="ByteArrayContent" />.</param>
        /// <param name="fileName">The file name.</param>
        /// <returns>The <see cref="ISolidHttpRequest" /> so that additional calls can be chained.</returns>
        public static ISolidHttpRequest WithFormDataFile(this ISolidHttpRequest request, string name, ByteArrayContent content, string fileName)
        {
            var form = request.GetMultipartFormDataContent();

            form.Add(content, name, fileName);
            return(request);
        }
コード例 #2
0
        /// <summary>
        /// Adds form data content to the inner <see cref="HttpRequestMessage" />.
        /// </summary>
        /// <param name="request">The <see cref="ISolidHttpRequest" /> that is being extended.</param>
        /// <param name="name">The form name of the <see cref="HttpContent" />.</param>
        /// <param name="content">The <see cref="HttpContent" /> to add.</param>
        /// <returns>The <see cref="ISolidHttpRequest" /> so that additional calls can be chained.</returns>
        public static ISolidHttpRequest WithFormDataContent(this ISolidHttpRequest request, string name, HttpContent content)
        {
            var form = request.GetMultipartFormDataContent();

            form.Add(content, name);
            return(request);
        }