Exemplo n.º 1
0
 public static void Proxying(ILogger logger, HttpRequestMessage msg, bool isStreamingRequest)
 {
     // Avoid computing the AbsoluteUri unless logging is enabled
     if (logger.IsEnabled(LogLevel.Information))
     {
         var streaming     = isStreamingRequest ? "streaming" : "no-streaming";
         var version       = HttpProtocol.GetHttpProtocol(msg.Version);
         var versionPolicy = ProtocolHelper.GetVersionPolicy(msg.VersionPolicy);
         _proxying(logger, msg.RequestUri !.AbsoluteUri, version, versionPolicy, streaming, null);
     }
 }
Exemplo n.º 2
0
    public static string GetHttpProtocol(Version version)
    {
#if NET
        return(HttpProtocol.GetHttpProtocol(version));
#else
        if (version is null)
        {
            throw new ArgumentNullException(nameof(version));
        }

        return(version switch
        {
            { Major : 3, Minor : 0 } => "HTTP/3",
Exemplo n.º 3
0
        public void GetHttpProtocol_CorrectIETFVersion(Version version, string expected)
        {
            var actual = HttpProtocol.GetHttpProtocol(version);

            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
 public void GetHttpProtocol_ThrowErrorForUnknownVersion(Version version)
 {
     Assert.Throws <ArgumentOutOfRangeException>(() => HttpProtocol.GetHttpProtocol(version));
 }