-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support HttpClient configuration #259
feat: support HttpClient configuration #259
Conversation
@@ -172,6 +173,7 @@ namespace {{packageName}}.Client | |||
{{>visibility}} partial class ApiClient : ISynchronousClient{{#supportsAsync}}, IAsynchronousClient{{/supportsAsync}} | |||
{ | |||
private readonly string _baseUrl; | |||
private HttpClient _httpClient; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allowing the client to customize the HttpClient that RestSharp uses internally.
MaxTimeout = configuration.Timeout, | ||
Proxy = configuration.Proxy, | ||
UserAgent = configuration.UserAgent | ||
UserAgent = configuration.UserAgent, | ||
ThrowOnAnyError = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throws all errors encountered during the http process.
this.HeaderParameters.Add("BT-IDEMPOTENCY-KEY", value); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convenience properties to set Basis Theory specific request headers.
if(requestOptions == default(BasisTheory.net.Client.RequestOptions)) | ||
{ | ||
requestOptions = new BasisTheory.net.Client.RequestOptions(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allowing the client to pass a RequestOptions
object. The previous template created the RequestOptions internally.
# [3.1.0](v3.0.0...v3.1.0) (2024-07-10) ### Features * support HttpClient configuration ([#259](#259)) ([8b5afc9](8b5afc9))
🎉 This PR is included in version 3.1.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Description
genericHost
option as described in the conversation, but that had problems too (and is still marked as "experimental").BT-TRACE-ID
andBT-IDEMPOTENCY-KEY
). The original generated template did not pass in aRequestOptions
class as parameters. I applied the patch found here: [REQ][csharp-netcore] Add Request Options as a parameter to the Wrapper API methods OpenAPITools/openapi-generator#11010. I had to make some minor modifications.CorrelationId
andIdempotencyKey
to theRequestOptions
as shortcuts to adding the request headers.TenantUserAuthenticationHandler
in the Admin API.Draft PR for the Developer Documentation: Basis-Theory/developers.basistheory.com#409
Testing required outside of automated testing?
Screenshots (if appropriate):
Rollback / Rollforward Procedure
Reviewer Checklist