File tree 1 file changed +24
-9
lines changed 1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -185,15 +185,6 @@ class Program
185
185
}
186
186
```
187
187
188
- <a name =" proxy " ></a >
189
- ## Web Proxy
190
-
191
- ``` csharp
192
- var apiKey = Environment .GetEnvironmentVariable (" SENDGRID_API_KEY" );
193
- var proxy = new WebProxy (" http://proxy:1337" );
194
- var client = new SendGridClient (proxy , apiKey );
195
- ```
196
-
197
188
## HttpClientFactory + Microsoft.Extensions.DependencyInjection
198
189
199
190
> [ SendGrid.Extensions.DependencyInjection] ( https://www.nuget.org/packages/SendGrid.Extensions.DependencyInjection ) is required
@@ -234,6 +225,30 @@ class Program
234
225
}
235
226
```
236
227
228
+ <a name =" proxy " ></a >
229
+ ## Web Proxy
230
+
231
+ ``` csharp
232
+ var apiKey = Environment .GetEnvironmentVariable (" SENDGRID_API_KEY" );
233
+ var proxy = new WebProxy (" http://proxy:1337" );
234
+ var client = new SendGridClient (proxy , apiKey );
235
+ ```
236
+
237
+ Or when using DependencyInjection
238
+
239
+ ``` csharp
240
+ services .AddSendGrid (options =>
241
+ {
242
+ options .ApiKey = Environment .GetEnvironmentVariable (" SENDGRID_API_KEY" );
243
+ })
244
+ .ConfigurePrimaryHttpMessageHandler (_ => new HttpClientHandler ()
245
+ {
246
+ Proxy = new WebProxy (new Uri (" http://proxy:1337" )),
247
+ UseProxy = true
248
+ });
249
+ ```
250
+
251
+
237
252
# Usage
238
253
239
254
- [ Twilio SendGrid Docs] ( https://docs.sendgrid.com/api-reference/ )
You can’t perform that action at this time.
0 commit comments