@@ -114,7 +114,10 @@ public HttpResult Get(string url, StringDictionary headers, string token, bool b
114114 {
115115 foreach ( string fieldName in headers . Keys )
116116 {
117- wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
117+ if ( ! WebHeaderCollection . IsRestricted ( fieldName ) )
118+ {
119+ wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
120+ }
118121 }
119122
120123 if ( headers . ContainsKey ( "Content-Type" ) )
@@ -264,7 +267,10 @@ public HttpResult Post(string url, StringDictionary headers, string token, bool
264267 {
265268 foreach ( string fieldName in headers . Keys )
266269 {
267- wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
270+ if ( ! WebHeaderCollection . IsRestricted ( fieldName ) )
271+ {
272+ wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
273+ }
268274 }
269275
270276 if ( headers . ContainsKey ( "Content-Type" ) )
@@ -1125,7 +1131,10 @@ public HttpResult PostForm(string url, StringDictionary headers, byte[] data, st
11251131 {
11261132 foreach ( string fieldName in headers . Keys )
11271133 {
1128- wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
1134+ if ( ! WebHeaderCollection . IsRestricted ( fieldName ) )
1135+ {
1136+ wReq . Headers . Add ( fieldName , headers [ fieldName ] ) ;
1137+ }
11291138 }
11301139 }
11311140 if ( ! string . IsNullOrEmpty ( token ) )
0 commit comments