HttpRequestExtensions.cs from git-ecosystem/git-credential-manager
// Source: https://github.com/git-ecosystem/git-credential-manager | License: MIT | Copyright GitHub, Inc. and contributors
// Provided via justclaw.it.com; keep this notice with the code.
using System;
using System.Globalization;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
namespace GitCredentialManager
{
public static class HttpRequestExtensions
{
/// <summary>
/// Add a basic authentication header to the request, with the given username and password.
/// </summary>
/// <remarks>
/// The header value is formed by computing the base64 string from the UTF-8 string "{<paramref name="userName"/>}:{<paramref name="password"/>}".
/// </remarks>
public static void AddBasicAuthenticationHeader(this Http
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key