Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 1994e93

Browse files
committed
Only export brotli compression in net6
1 parent 9b60998 commit 1994e93

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/ServiceStack.Text/HttpUtils.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,16 +2006,29 @@ public static class HttpMethods
20062006

20072007
public static class CompressionTypes
20082008
{
2009-
public static readonly string[] AllCompressionTypes = { Deflate, GZip };
2009+
public static readonly string[] AllCompressionTypes =
2010+
{
2011+
#if NET6_0_OR_GREATER
2012+
Brotli,
2013+
#endif
2014+
Deflate,
2015+
GZip,
2016+
};
20102017

20112018
public const string Default = Deflate;
2019+
#if NET6_0_OR_GREATER
20122020
public const string Brotli = "br";
2021+
#endif
20132022
public const string Deflate = "deflate";
20142023
public const string GZip = "gzip";
20152024

20162025
public static bool IsValid(string compressionType)
20172026
{
2018-
return compressionType is Deflate or GZip or Brotli;
2027+
return compressionType is Deflate or GZip
2028+
#if NET6_0_OR_GREATER
2029+
or Brotli
2030+
#endif
2031+
;
20192032
}
20202033

20212034
public static void AssertIsValid(string compressionType)
@@ -2031,7 +2044,9 @@ public static string GetExtension(string compressionType)
20312044
{
20322045
switch (compressionType)
20332046
{
2047+
#if NET6_0_OR_GREATER
20342048
case Brotli:
2049+
#endif
20352050
case Deflate:
20362051
case GZip:
20372052
return "." + compressionType;

0 commit comments

Comments
 (0)