File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -115,8 +115,23 @@ private async Task<HttpResponseMessage> GetResponseImplAsync(RequestOptions opti
115115 private HttpRequestMessage CreateRequest ( RequestOptions options )
116116 {
117117 var request = new HttpRequestMessage ( new HttpMethod ( Method . ToString ( ) . ToUpperInvariant ( ) ) , Url ) ;
118- if ( HasOutput )
118+ // Copy headers from Headers property to request
119+ if ( Headers != null )
119120 {
121+ foreach ( var key in Headers . AllKeys )
122+ {
123+ var values = Headers . GetValues ( key ) ;
124+ if ( ! request . Headers . TryAddWithoutValidation ( key , values ) )
125+ {
126+ // If it fails to add as a request header, it might be a content header
127+ if ( request . Content != null )
128+ {
129+ request . Content . Headers . TryAddWithoutValidation ( key , values ) ;
130+ }
131+ }
132+ }
133+ }
134+ if ( HasOutput )
120135 if ( FormData != null )
121136 {
122137 AddFileData ( request , options ) ;
You can’t perform that action at this time.
0 commit comments