Skip to content

Commit

Permalink
#53
Browse files Browse the repository at this point in the history
* added header support
  • Loading branch information
mrksoftware committed Mar 26, 2020
1 parent 5b04d86 commit 4c7815d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class WebWatcherConfigurationModel : IAmConfigurationModelWithResolution
/// <summary>
/// Request headers.
/// </summary>
public IDictionary<string, string> Headers { get; set; } = null;
public IDictionary<string, string> Headers { get; set; }
}

public enum HttpCallApiMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ HttpClient InitializeApiClient(WebWatcherConfigurationModel configuration)
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

if (configuration.Headers?.Count > 0)
foreach (var header in configuration.Headers)
client.DefaultRequestHeaders.Add(header.Key, header.Value);

return client;
}
}
Expand Down

0 comments on commit 4c7815d

Please sign in to comment.