Skip to content

Commit

Permalink
- Add proxy usage example to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 committed May 17, 2024
1 parent 2fbb4d3 commit 2af7f8c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,28 @@ client.Hooks.OnRequestExecuting += (sender, args) => { /* ... */ };
client.Hooks.OnRequestExecuting -= OnRequestExecutingHandler;
```

### Proxies

If you need to use a proxy to make requests to the EasyPost API, you can define a custom `HttpClientHandler` on a custom `HttpClient` passed to the `ClientConfiguration` constructor.

```csharp
// Define a custom HttpClientHandler with details about the proxy
HttpClientHandler handler = new()
{
UseProxy = true,
Proxy = new WebProxy($"http://localhost:8888"),
};

// Define a custom HttpClient with the custom handler
HttpClient httpClient = new(handler: handler);

// Pass the custom HttpClient to the ClientConfiguration constructor when creating a new EasyPost Client
Client client = new(new ClientConfiguration(FakeApikey)
{
CustomHttpClient = httpClient,
});
```

## Documentation

API documentation can be found at: <https://easypost.com/docs/api>.
Expand Down

0 comments on commit 2af7f8c

Please sign in to comment.