예제 #1
0
 /// <summary>
 /// Sets the Referer header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Referer header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Referrer(this IWith @this, Uri value)
 => @this.Modify(request => request.Headers.Referrer = value);
예제 #2
0
 /// <summary>
 /// Sets the Transfer-Encoding header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Transfer-Encoding header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest TransferEncodingChunked(this IWith @this, bool value)
 => @this.Modify(request => request.Headers.TransferEncodingChunked = value);
예제 #3
0
 /// <summary>
 /// Sets the header of the request to the specified name and values.
 /// </summary>
 /// <param name="name">The header name.</param>
 /// <param name="values">The header values.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Header(this IWith @this, string name, params string[] values)
 => @this.Modify(request => request.Headers.Add(name, values));
예제 #4
0
 /// <summary>
 /// Sets the Range header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Range header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Range(this IWith @this, RangeHeaderValue value)
 => @this.Modify(request => request.Headers.Range = value);
예제 #5
0
 /// <summary>
 /// Adds a parameter to the query string of the request with the specified name.
 /// </summary>
 /// <param name="name">The parameter name.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Query(this IWith @this, string name)
 => @this.Modify(request => request.RequestUri = AppendQuery(request.RequestUri, name));
예제 #6
0
 /// <summary>
 /// Sets the content of the request to the specified content with values.
 /// </summary>
 /// <param name="content">The HTTP content.</param>
 /// <param name="values">The HTTP content to add to the collection.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 private static IRequest MultipartFormData(this IWith @this, MultipartFormDataContent content, params HttpContent[] values)
 => @this.Modify(SetMultipartFormDataContentWithValues(content, values));
예제 #7
0
 /// <summary>
 /// Sets the Host header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Host header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Host(this IWith @this, string value)
 => @this.Modify(request => request.Headers.Host = value);
 /// <summary>
 /// Sets the Content-MD5 header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Content-MD5 header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ContentMD5(this IWith @this, byte[] value)
 => @this.Modify(request => request.Content.Headers.ContentMD5 = value);
예제 #9
0
 /// <summary>
 /// Sets the Expect header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Expect header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ExpectContinue(this IWith @this, bool value)
 => @this.Modify(request => request.Headers.ExpectContinue = value);
예제 #10
0
 /// <summary>
 /// Sets the From header of the request to the specified value.
 /// </summary>
 /// <param name="value">The From header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest From(this IWith @this, string value)
 => @this.Modify(request => request.Headers.From = value);
예제 #11
0
 /// <summary>
 /// Sets the Date header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Date header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Date(this IWith @this, DateTimeOffset value)
 => @this.Modify(request => request.Headers.Date = value);
예제 #12
0
 /// <summary>
 /// Sets the Connection header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Connection header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ConnectionClose(this IWith @this, bool value)
 => @this.Modify(request => request.Headers.ConnectionClose = value);
예제 #13
0
 /// <summary>
 /// Sets the Cache-Control header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Cache-Control header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest CacheControl(this IWith @this, CacheControlHeaderValue value)
 => @this.Modify(request => request.Headers.CacheControl = value);
예제 #14
0
 private static IRequest AddHeaderValue <T>(this IWith @this, Func <HttpRequestHeaders, ICollection <T> > selector, T value)
 => @this.Modify(request => selector(request.Headers).Add(value));
예제 #15
0
 /// <summary>
 /// Sets the If-Range header of the request to the specified value.
 /// </summary>
 /// <param name="value">The If-Range header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest IfRange(this IWith @this, RangeConditionHeaderValue value)
 => @this.Modify(request => request.Headers.IfRange = value);
 /// <summary>
 /// Sets the Content-Length header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Content-Length header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ContentLength(this IWith @this, long value)
 => @this.Modify(request => request.Content.Headers.ContentLength = value);
예제 #17
0
 /// <summary>
 /// Sets the If-Unmodified-Since header of the request to the specified value.
 /// </summary>
 /// <param name="value">The If-Unmodified-Since header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest IfUnmodifiedSince(this IWith @this, DateTimeOffset value)
 => @this.Modify(request => request.Headers.IfUnmodifiedSince = value);
 /// <summary>
 /// Sets the Content-Type header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Content-Type header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ContentType(this IWith @this, MediaTypeHeaderValue value)
 => @this.Modify(request => request.Content.Headers.ContentType = value);
예제 #19
0
 /// <summary>
 /// Sets the Max-Forwards header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Max-Forwards header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest MaxForwards(this IWith @this, int value)
 => @this.Modify(request => request.Headers.MaxForwards = value);
예제 #20
0
 /// <summary>
 /// Adds a parameter to the query string of the request with the specified name and value.
 /// </summary>
 /// <param name="name">The parameter name.</param>
 /// <param name="value">The parameter value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Query(this IWith @this, string name, object value)
 => @this.Modify(request => request.RequestUri = AppendQuery(request.RequestUri, $"{name}={value}"));
예제 #21
0
 /// <summary>
 /// Sets the Proxy-Authorization header of the request to the specified value.
 /// </summary>
 /// <param name="value">The Proxy-Authorization header value.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest ProxyAuthorization(this IWith @this, AuthenticationHeaderValue value)
 => @this.Modify(request => request.Headers.ProxyAuthorization = value);
예제 #22
0
 /// <summary>
 /// Sets the content of the request to the specified content.
 /// </summary>
 /// <param name="content">The HTTP content.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Content(this IWith @this, HttpContent content)
 => @this.Modify(request => request.Content = content);
예제 #23
0
 /// <summary>
 /// Sets the HTTP version of the request to the specified version.
 /// </summary>
 /// <param name="version">The HTTP request version.</param>
 /// <returns>An <see cref="IRequest"/> object that represents the request.</returns>
 public static IRequest Version(this IWith @this, Version version)
 => @this.Modify(request => request.Version = version);