@@ -64,7 +64,7 @@ static Api()
6464 /// Assumes that environment variable CLOUDINARY_URL is set.
6565 /// </summary>
6666 public Api ( )
67- : this ( Environment . GetEnvironmentVariable ( "CLOUDINARY_URL" ) ) { }
67+ : this ( Environment . GetEnvironmentVariable ( "CLOUDINARY_URL" ) ) { }
6868
6969 /// <summary>
7070 /// Parameterized constructor
@@ -302,7 +302,7 @@ public static T ParseCloudinaryParam<T>(string s)
302302 /// <param name="parameters">Dictionary of call parameters (can be null)</param>
303303 /// <param name="file">File to upload (must be null for non-uploading actions)</param>
304304 /// <returns>HTTP response on call</returns>
305- public HttpWebResponse Call ( HttpMethod method , string url , SortedDictionary < string , object > parameters , FileDescription file )
305+ public HttpWebResponse Call ( HttpMethod method , string url , SortedDictionary < string , object > parameters , FileDescription file , Dictionary < string , string > extraHeaders = null )
306306 {
307307#if DEBUG
308308 Console . WriteLine ( String . Format ( "{0} REQUEST:" , method ) ) ;
@@ -311,7 +311,6 @@ public HttpWebResponse Call(HttpMethod method, string url, SortedDictionary<stri
311311
312312 HttpWebRequest request = RequestBuilder ( url ) ;
313313 request . Method = Enum . GetName ( typeof ( HttpMethod ) , method ) ;
314-
315314 // Add platform information to the USER_AGENT header
316315 // This is intended for platform information and not individual applications!
317316 request . UserAgent = string . IsNullOrEmpty ( UserPlatform )
@@ -322,10 +321,16 @@ public HttpWebResponse Call(HttpMethod method, string url, SortedDictionary<stri
322321 {
323322 request . Timeout = Timeout ;
324323 }
325-
326324 byte [ ] authBytes = Encoding . ASCII . GetBytes ( String . Format ( "{0}:{1}" , Account . ApiKey , Account . ApiSecret ) ) ;
327325 request . Headers . Add ( "Authorization" , String . Format ( "Basic {0}" , Convert . ToBase64String ( authBytes ) ) ) ;
328326
327+ if ( extraHeaders != null )
328+ {
329+ foreach ( var header in extraHeaders )
330+ {
331+ request . Headers [ header . Key ] = header . Value ;
332+ }
333+ }
329334 if ( ( method == HttpMethod . POST || method == HttpMethod . PUT ) && parameters != null )
330335 {
331336 if ( UseChunkedEncoding )
0 commit comments