File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed
Servers/HttpSys/test/FunctionalTests
Shared/HttpSys/RequestProcessing Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
4
using System ;
5
+ using System . Collections . Generic ;
5
6
using System . Net . Http ;
6
7
using System . Net . Sockets ;
7
8
using System . Text ;
@@ -57,7 +58,26 @@ public async Task RequestHeaders_ClientSendsCustomHeaders_Success()
57
58
await SendRequestAsync ( address , "Custom-Header" , customValues ) ;
58
59
}
59
60
}
60
-
61
+
62
+ [ ConditionalFact ]
63
+ public async Task RequestHeaders_ServerAddsCustomHeaders_Success ( )
64
+ {
65
+ string address ;
66
+ using ( Utilities . CreateHttpServer ( out address , httpContext =>
67
+ {
68
+ var requestHeaders = httpContext . Request . Headers ;
69
+ var header = KeyValuePair . Create ( "Custom-Header" , new StringValues ( "custom" ) ) ;
70
+ requestHeaders . Add ( header ) ;
71
+
72
+ Assert . True ( requestHeaders . Contains ( header ) ) ;
73
+ return Task . FromResult ( 0 ) ;
74
+ } ) )
75
+ {
76
+ string response = await SendRequestAsync ( address ) ;
77
+ Assert . Equal ( string . Empty , response ) ;
78
+ }
79
+ }
80
+
61
81
private async Task < string > SendRequestAsync ( string uri )
62
82
{
63
83
using ( HttpClient client = new HttpClient ( ) )
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ public bool TryGetValue(string key, out StringValues value)
110
110
111
111
void ICollection < KeyValuePair < string , StringValues > > . Add ( KeyValuePair < string , StringValues > item )
112
112
{
113
- ( ( IDictionary < string , object > ) this ) . Add ( item . Key , item . Value ) ;
113
+ ( ( IDictionary < string , StringValues > ) this ) . Add ( item . Key , item . Value ) ;
114
114
}
115
115
116
116
void ICollection < KeyValuePair < string , StringValues > > . Clear ( )
@@ -124,8 +124,7 @@ void ICollection<KeyValuePair<string, StringValues>>.Clear()
124
124
125
125
bool ICollection < KeyValuePair < string , StringValues > > . Contains ( KeyValuePair < string , StringValues > item )
126
126
{
127
- object value ;
128
- return ( ( IDictionary < string , object > ) this ) . TryGetValue ( item . Key , out value ) && Object . Equals ( value , item . Value ) ;
127
+ return ( ( IDictionary < string , StringValues > ) this ) . TryGetValue ( item . Key , out var value ) && Equals ( value , item . Value ) ;
129
128
}
130
129
131
130
void ICollection < KeyValuePair < string , StringValues > > . CopyTo ( KeyValuePair < string , StringValues > [ ] array , int arrayIndex )
You can’t perform that action at this time.
0 commit comments