@@ -23,12 +23,14 @@ public static ResponseHeaders GetTypedHeaders(this HttpResponse response)
23
23
return new ResponseHeaders ( response . Headers ) ;
24
24
}
25
25
26
- public static DateTimeOffset ? GetDate ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name )
26
+ // These are all shared helpers used by both RequestHeaders and ResponseHeaders
27
+
28
+ internal static DateTimeOffset ? GetDate ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name )
27
29
{
28
30
return headers . Get < DateTimeOffset ? > ( name ) ;
29
31
}
30
32
31
- public static void Set ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , object value )
33
+ internal static void Set ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , object value )
32
34
{
33
35
if ( value == null )
34
36
{
@@ -40,7 +42,7 @@ public static void Set([NotNull] this IHeaderDictionary headers, [NotNull] strin
40
42
}
41
43
}
42
44
43
- public static void SetList < T > ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , IList < T > values )
45
+ internal static void SetList < T > ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , IList < T > values )
44
46
{
45
47
if ( values == null || values . Count == 0 )
46
48
{
@@ -52,7 +54,7 @@ public static void SetList<T>([NotNull] this IHeaderDictionary headers, [NotNull
52
54
}
53
55
}
54
56
55
- public static void SetDate ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , DateTimeOffset ? value )
57
+ internal static void SetDate ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , DateTimeOffset ? value )
56
58
{
57
59
if ( value . HasValue )
58
60
{
@@ -64,16 +66,6 @@ public static void SetDate([NotNull] this IHeaderDictionary headers, [NotNull] s
64
66
}
65
67
}
66
68
67
- public static void Append ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , [ NotNull ] object value )
68
- {
69
- headers . Append ( name , value . ToString ( ) ) ;
70
- }
71
-
72
- public static void AppendList < T > ( [ NotNull ] this IHeaderDictionary headers , [ NotNull ] string name , [ NotNull ] IList < T > values )
73
- {
74
- headers . AppendValues ( name , values . Select ( value => value . ToString ( ) ) . ToArray ( ) ) ;
75
- }
76
-
77
69
private static IDictionary < Type , object > KnownParsers = new Dictionary < Type , object > ( )
78
70
{
79
71
{ typeof ( CacheControlHeaderValue ) , new Func < string , CacheControlHeaderValue > ( value => { CacheControlHeaderValue result ; return CacheControlHeaderValue . TryParse ( value , out result ) ? result : null ; } ) } ,
@@ -96,7 +88,7 @@ public static void AppendList<T>([NotNull] this IHeaderDictionary headers, [NotN
96
88
{ typeof ( SetCookieHeaderValue ) , new Func < IList < string > , IList < SetCookieHeaderValue > > ( value => { IList < SetCookieHeaderValue > result ; return SetCookieHeaderValue . TryParseList ( value , out result ) ? result : null ; } ) } ,
97
89
} ;
98
90
99
- public static T Get < T > ( [ NotNull ] this IHeaderDictionary headers , string name )
91
+ internal static T Get < T > ( [ NotNull ] this IHeaderDictionary headers , string name )
100
92
{
101
93
object temp ;
102
94
if ( KnownParsers . TryGetValue ( typeof ( T ) , out temp ) )
@@ -114,7 +106,7 @@ public static T Get<T>([NotNull] this IHeaderDictionary headers, string name)
114
106
return GetViaReflection < T > ( value ) ;
115
107
}
116
108
117
- public static IList < T > GetList < T > ( [ NotNull ] this IHeaderDictionary headers , string name )
109
+ internal static IList < T > GetList < T > ( [ NotNull ] this IHeaderDictionary headers , string name )
118
110
{
119
111
object temp ;
120
112
if ( KnownListParsers . TryGetValue ( typeof ( T ) , out temp ) )
0 commit comments