Skip to content

Commit

Permalink
change path to url in client
Browse files Browse the repository at this point in the history
  • Loading branch information
eltinMeli committed Feb 6, 2024
1 parent fe2d9ad commit a04fea5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions pkg/internal/httpclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
)

const (
domainMP = "https://api.mercadopago.com"

currentSDKVersion string = "x.x.x"
productID string = "abc"
accept string = "application/json"
Expand Down Expand Up @@ -116,14 +114,12 @@ func makeHeaders(req *http.Request, cfg *config.Config) {
}
}

func buildHTTPRequest(ctx context.Context, method, path string, body any) (*http.Request, error) {
func buildHTTPRequest(ctx context.Context, method, url string, body any) (*http.Request, error) {
b, err := buildBody(body)
if err != nil {
return nil, err
}

var url = domainMP + path

return http.NewRequestWithContext(ctx, method, url, b)
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/paymentmethod/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/mercadopago/sdk-go/pkg/internal/httpclient"
)

const path = "/v1/payment_methods"
const url = "https://api.mercadopago.com/v1/payment_methods"

// Client contains the methods to interact with the Payment Methods API.
type Client interface {
Expand All @@ -28,7 +28,7 @@ func NewClient(cfg *config.Config) Client {
}

func (c *client) List(ctx context.Context) ([]Response, error) {
res, err := httpclient.Get[[]Response](ctx, c.cfg, path)
res, err := httpclient.Get[[]Response](ctx, c.cfg, url)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit a04fea5

Please sign in to comment.