/// <summary> /// Set basic authentication header. /// </summary> /// <param name="builder">builder instance.</param> /// <param name="token">Auth token to add.</param> /// <returns>Returns request builder for chaining.</returns> public static T WithBasicAuthentication <T>(this IFluentHttpHeaderBuilder <T> builder, string token) { if (string.IsNullOrEmpty(token)) { throw new ArgumentNullException(nameof(token)); } builder.WithHeader(HeaderTypes.Authorization, $"{AuthSchemeTypes.Basic} {token}"); return((T)builder); }
/// <summary> /// Set user-agent header. /// </summary> /// <param name="builder">builder instance.</param> /// <param name="userAgent">User agent value to set.</param> /// <returns>Returns request builder for chaining.</returns> public static T WithUserAgent <T>(this IFluentHttpHeaderBuilder <T> builder, string userAgent) { if (string.IsNullOrEmpty(userAgent)) { throw new ArgumentNullException(nameof(userAgent)); } builder.WithHeader(HeaderTypes.UserAgent, userAgent); return((T)builder); }