public SendGridService(IOptions <AppSettings> settings) { _options = settings.Value.SendGrid; if (string.IsNullOrEmpty(_options.ApiKey)) { throw new InvalidOperationException("A SendGrid API key needs to be configured."); } _http = new HttpClient(); _http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _options.ApiKey); }
public SendGridService(IOptions<AppSettings> settings) { _options = settings.Value.SendGrid; if (string.IsNullOrEmpty(_options.ApiKey)) { throw new InvalidOperationException("A SendGrid API key needs to be configured."); } _http = new HttpClient(); _http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _options.ApiKey); }