src/Microsoft.PackageManagement.NuGetProvider/NugetLightClient.cs
/// <summary>
/// Returns the appropriate stream depending on the encoding
/// </summary>
/// <param name="response"></param>
/// <returns></returns>
Returns the appropriate stream depending on the encoding
Returns the appropriate stream depending on the encoding
private static Stream GetStreamBasedOnEncoding(HttpResponseMessage response)
        {
            Stream result = response.Content.ReadAsStreamAsync().Result;
            if (response.Content.Headers.ContentEncoding.Contains("gzip"))
            {
                return new GZipStream(result, CompressionMode.Decompress);
            }
            else if (response.Content.Headers.ContentEncoding.Contains("deflate"))
            {
                return new DeflateStream(result, CompressionMode.Decompress);
            }
            return result;
        }
private static Stream GetStreamBasedOnEncoding ( HttpResponseMessage response ) { Stream result = response . Content . ReadAsStreamAsync ( ) . Result ; if ( response . Content . Headers . ContentEncoding . Contains ( " " ) ) { return new GZipStream ( result , CompressionMode . Decompress ) ; } else if ( response . Content . Headers . ContentEncoding . Contains ( " " ) ) { return new DeflateStream ( result , CompressionMode . Decompress ) ; } return result ; }
Returns the appropriate stream depending on the encoding
Returns the appropriate stream depending on the encoding
// Gzip encoding so returns gzip stream // Deflate encoding so returns deflate stream
None
response
HttpResponseMessage
None