File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ protected WebRequestOptions(WebRequestOptions<TCompleated> options) : base(optio
4949 Timeout = options . Timeout ;
5050 Headers = new ( ) ;
5151 foreach ( string key in options . Headers . AllKeys )
52- Headers . Add ( key , Headers [ key ] ) ;
52+ Headers . Add ( key , options . Headers [ key ] ) ;
5353 UserAgent = options . UserAgent ;
5454 }
5555 }
Original file line number Diff line number Diff line change @@ -35,8 +35,12 @@ namespace DownloadAssistant.Requests
3535 protected HttpRequestMessage GetPresetRequestMessage ( HttpRequestMessage ? httpRequest = null )
3636 {
3737 httpRequest ??= new HttpRequestMessage ( ) ;
38- foreach ( string key in Options . Headers ? . AllKeys ?? Array . Empty < string > ( ) )
39- httpRequest . Headers . Add ( key , Options . Headers ? [ key ] ) ;
38+ foreach ( string key in Options . Headers . AllKeys ?? Array . Empty < string > ( ) )
39+ {
40+ string ? headerValue = Options . Headers [ key ] ;
41+ if ( ! string . IsNullOrEmpty ( headerValue ) )
42+ httpRequest . Headers . TryAddWithoutValidation ( key , headerValue ) ;
43+ }
4044
4145 if ( ! string . IsNullOrWhiteSpace ( Options . UserAgent ) )
4246 httpRequest . Headers . Add ( "User-Agent" , Options . UserAgent ) ;
You can’t perform that action at this time.
0 commit comments