-
Notifications
You must be signed in to change notification settings - Fork 1
refator(BREAKING)!: add support to create new requests Client #46
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #46 +/- ##
==========================================
- Coverage 80.32% 80.19% -0.13%
==========================================
Files 6 7 +1
Lines 432 409 -23
==========================================
- Hits 347 328 -19
+ Misses 61 59 -2
+ Partials 24 22 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| func (r *Request) WithContext(ctx context.Context) *Request { | ||
| func (r *Request) WithContext(ctx context.Context) { | ||
| r.Request = r.Request.WithContext(ctx) | ||
| return r |
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.
No needed?
| func newDefaultClient() *Client { | ||
| return &Client{ | ||
| client: &http.Client{ | ||
| CheckRedirect: redirector.RedirectPolicyFunc, | ||
| }, | ||
| } | ||
| } | ||
|
|
||
| func GetDefaultClient() *Client { | ||
| once.Do(func() { | ||
| defaultClient = newDefaultClient() | ||
| }) | ||
| return defaultClient | ||
| } |
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.
- Default client should not be public.
- Timeout default to
10sfor common use cases.
client.go
Outdated
| // WithInterceptor specifies an interceptor for requests made by this client. | ||
| // Use `ChainInterceptors` to chain multiple interceptors into one. |
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.
- Use doc links (see https://tip.golang.org/doc/comment#doclinks):``ChainInterceptors`` -> [ChainInterceptors]
- Confusing
for requests made by this client.->for client.
No description provided.