♻️ Use provided context in HTTP profile repository method
This commit is contained in:
parent
6ffdc532ec
commit
efe077f181
|
@ -27,8 +27,13 @@ func NewHTPPClientRepository(client *http.Client) profile.Repository {
|
|||
}
|
||||
|
||||
//nolint:cyclop,funlen
|
||||
func (repo *httpProfileRepository) Fetch(_ context.Context, me domain.Me) (*domain.Profile, error) {
|
||||
resp, err := repo.client.Get(me.String())
|
||||
func (repo *httpProfileRepository) Fetch(ctx context.Context, me domain.Me) (*domain.Profile, error) {
|
||||
req, err := http.NewRequestWithContext(ctx, http.MethodGet, me.String(), nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot build request to provided me '%s': %w", me, err)
|
||||
}
|
||||
|
||||
resp, err := repo.client.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: cannot fetch user by me: %w", profile.ErrNotExist, err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue