Ejemplo n.º 1
0
        /// <summary>
        /// Adds a header to the <see cref="ISolidHttpRequest" />.
        /// </summary>
        /// <param name="request">The <see cref="ISolidHttpRequest" /> that is being extended.</param>
        /// <param name="name">The name of the header.</param>
        /// <param name="firstValue">The first value of the header.</param>
        /// <param name="secondValue">The second value of the header.</param>
        /// <param name="moreValues">More values for the header.</param>
        /// <returns>The <see cref="ISolidHttpRequest" /> so that additional calls can be chained.</returns>
        public static ISolidHttpRequest WithHeader(this ISolidHttpRequest request, string name, object firstValue, object secondValue, params object[] moreValues)
        {
            var values = new[] { firstValue, secondValue }.Concat(moreValues).SelectMany(o => o.ConvertToStrings());

            return(request.WithHeaders(headers => headers.Add(name, values)));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a header to the <see cref="ISolidHttpRequest" />.
 /// </summary>
 /// <param name="request">The <see cref="ISolidHttpRequest" /> that is being extended.</param>
 /// <param name="name">The name of the header.</param>
 /// <param name="values">The value(s) for the header.</param>
 /// <returns>The <see cref="ISolidHttpRequest" /> so that additional calls can be chained.</returns>
 public static ISolidHttpRequest WithHeader(this ISolidHttpRequest request, string name, StringValues values)
 => request.WithHeaders(headers => headers.Add(name, values.ToArray()));
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a header to the <see cref="ISolidHttpRequest" />.
 /// </summary>
 /// <param name="request">The <see cref="ISolidHttpRequest" /> that is being extended.</param>
 /// <param name="name">The name of the header.</param>
 /// <param name="value">The value of the header.</param>
 /// <returns>The <see cref="ISolidHttpRequest" /> so that additional calls can be chained.</returns>
 public static ISolidHttpRequest WithHeader(this ISolidHttpRequest request, string name, object value)
 => request.WithHeaders(headers => headers.Add(name, value.ConvertToStrings()));
Ejemplo n.º 4
0
        /// <summary>
        /// Adds a header to the http request
        /// </summary>
        /// <param name="request">The SolidHttpRequest</param>
        /// <param name="name">The name of the header</param>
        /// <param name="firstValue">The first value of the header</param>
        /// <param name="secondValue">The second value of the header</param>
        /// <param name="moreValues">More values for the header</param>
        /// <returns>ISolidHttpRequest</returns>
        public static ISolidHttpRequest WithHeader(this ISolidHttpRequest request, string name, string firstValue, string secondValue, params string[] moreValues)
        {
            var values = new[] { firstValue, secondValue }.Concat(moreValues);

            return(request.WithHeaders(headers => headers.Add(name, values)));
        }