Skip to content

Commit

Permalink
Add FormatURLPath helper to allow safer URL path building
Browse files Browse the repository at this point in the history
Adds a helper to the top-level package called `FormatURLPath`. It's
basically a pass-through to `Sprintf`, except that it only takes string
parameters. This is designed to make invocations slightly more safe --
we've had a little trouble in the past where a string pointer was
accidentally passed instead of a string, and because `Sprintf` doesn't
automatically dereference or anything, the result is an invalid URL.

It also gives us the opportunity to call `url.QueryEscape` on every
parameter for a little additional safety. Previously, this was being
invoked manually only in certain packages like `plan`.

I changed all uses of `%v` in invocations to `%s` for consistency and
because we won't need any types beyond strings. In the same spirit, I
also changed all the places that we were concatenating strings (like
`"/skus/"+id`) to invoke `FormatURLPath`.

This patch is fairly noisy, but you can mostly just examine the added
function in `stripe.go` and test in `stripe_test.go`:

``` go
func FormatURLPath(format string, params ...string) string {
    // Parameters must be converted to interface{} before we send them to
    // Sprintf.
    untypedParams := make([]interface{}, len(params))
    for i, param := range params {
	    untypedParams[i] = interface{}(url.QueryEscape(param))
    }

    return fmt.Sprintf(format, untypedParams...)
}
```
  • Loading branch information
brandur committed Jun 6, 2018
1 parent 1960d3f commit 09d2c22
Show file tree
Hide file tree
Showing 43 changed files with 151 additions and 153 deletions.
8 changes: 4 additions & 4 deletions account/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c Client) GetByID(id string, params *stripe.AccountParams) (*stripe.Accoun
}

account := &stripe.Account{}
err := c.B.Call("GET", "/accounts/"+id, c.Key, body, commonParams, account)
err := c.B.Call("GET", stripe.FormatURLPath("/accounts/%s", id), c.Key, body, commonParams, account)

return account, err
}
Expand All @@ -82,7 +82,7 @@ func (c Client) Update(id string, params *stripe.AccountParams) (*stripe.Account
}

acct := &stripe.Account{}
err := c.B.Call("POST", "/accounts/"+id, c.Key, body, commonParams, acct)
err := c.B.Call("POST", stripe.FormatURLPath("/accounts/%s", id), c.Key, body, commonParams, acct)

return acct, err
}
Expand All @@ -103,7 +103,7 @@ func (c Client) Del(id string, params *stripe.AccountParams) (*stripe.Account, e
}

acct := &stripe.Account{}
err := c.B.Call("DELETE", "/accounts/"+id, c.Key, body, commonParams, acct)
err := c.B.Call("DELETE", stripe.FormatURLPath("/accounts/%s", id), c.Key, body, commonParams, acct)

return acct, err
}
Expand All @@ -119,7 +119,7 @@ func (c Client) Reject(id string, params *stripe.AccountRejectParams) (*stripe.A
body.Add("reason", stripe.StringValue(params.Reason))
}
acct := &stripe.Account{}
err := c.B.Call("POST", "/accounts/"+id+"/reject", c.Key, body, nil, acct)
err := c.B.Call("POST", stripe.FormatURLPath("/accounts/%s/reject", id), c.Key, body, nil, acct)

return acct, err
}
Expand Down
4 changes: 2 additions & 2 deletions applepaydomain/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (c Client) Get(id string, params *stripe.ApplePayDomainParams) (*stripe.App
}

domain := &stripe.ApplePayDomain{}
err := c.B.Call("GET", "/apple_pay/domains/"+id, c.Key, body, commonParams, domain)
err := c.B.Call("GET", stripe.FormatURLPath("/apple_pay/domains/%s", id), c.Key, body, commonParams, domain)

return domain, err
}
Expand All @@ -63,7 +63,7 @@ func (c Client) Del(id string, params *stripe.ApplePayDomainParams) (*stripe.App
}

domain := &stripe.ApplePayDomain{}
err := c.B.Call("DELETE", "/apple_pay/domains/"+id, c.Key, body, commonParams, domain)
err := c.B.Call("DELETE", stripe.FormatURLPath("/apple_pay/domains/%s", id), c.Key, body, commonParams, domain)

return domain, err
}
Expand Down
2 changes: 1 addition & 1 deletion balance/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c Client) GetBalanceTransaction(id string, params *stripe.BalanceTransacti
}

balance := &stripe.BalanceTransaction{}
err := c.B.Call("GET", "/balance/history/"+id, c.Key, body, commonParams, balance)
err := c.B.Call("GET", stripe.FormatURLPath("/balance/history/%s", id), c.Key, body, commonParams, balance)

return balance, err
}
Expand Down
21 changes: 10 additions & 11 deletions bankaccount/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package bankaccount

import (
"errors"
"fmt"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
Expand Down Expand Up @@ -31,9 +30,9 @@ func (c Client) New(params *stripe.BankAccountParams) (*stripe.BankAccount, erro
ba := &stripe.BankAccount{}
var err error
if params.Customer != nil {
err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources", stripe.StringValue(params.Customer)), c.Key, body, &params.Params, ba)
err = c.B.Call("POST", stripe.FormatURLPath("/customers/%s/sources", stripe.StringValue(params.Customer)), c.Key, body, &params.Params, ba)
} else {
err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts", stripe.StringValue(params.Account)), c.Key, body, &params.Params, ba)
err = c.B.Call("POST", stripe.FormatURLPath("/accounts/%s/external_accounts", stripe.StringValue(params.Account)), c.Key, body, &params.Params, ba)
}

return ba, err
Expand All @@ -58,9 +57,9 @@ func (c Client) Get(id string, params *stripe.BankAccountParams) (*stripe.BankAc
var err error

if params != nil && params.Customer != nil {
err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
err = c.B.Call("GET", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
} else if params != nil && params.Account != nil {
err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
err = c.B.Call("GET", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
} else {
err = errors.New("Invalid bank account params: either Customer or Account need to be set")
}
Expand All @@ -87,9 +86,9 @@ func (c Client) Update(id string, params *stripe.BankAccountParams) (*stripe.Ban
var err error

if params.Customer != nil {
err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
err = c.B.Call("POST", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
} else if params.Account != nil {
err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
err = c.B.Call("POST", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
} else {
err = errors.New("Invalid bank account params: either Customer or Account need to be set")
}
Expand All @@ -116,9 +115,9 @@ func (c Client) Del(id string, params *stripe.BankAccountParams) (*stripe.BankAc
var err error

if params.Customer != nil {
err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
err = c.B.Call("DELETE", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, ba)
} else if params.Account != nil {
err = c.B.Call("DELETE", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
err = c.B.Call("DELETE", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, commonParams, ba)
} else {
err = errors.New("Invalid bank account params: either Customer or Account need to be set")
}
Expand All @@ -145,9 +144,9 @@ func (c Client) List(params *stripe.BankAccountListParams) *Iter {
var err error

if params.Customer != nil {
err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources?object=bank_account", stripe.StringValue(params.Customer)), c.Key, b, p, list)
err = c.B.Call("GET", stripe.FormatURLPath("/customers/%s/sources?object=bank_account", stripe.StringValue(params.Customer)), c.Key, b, p, list)
} else if params.Account != nil {
err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts?object=bank_account", stripe.StringValue(params.Account)), c.Key, b, p, list)
err = c.B.Call("GET", stripe.FormatURLPath("/accounts/%s/external_accounts?object=bank_account", stripe.StringValue(params.Account)), c.Key, b, p, list)
} else {
err = errors.New("Invalid bank account params: either Customer or Account need to be set")
}
Expand Down
6 changes: 2 additions & 4 deletions bitcoinreceiver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
package bitcoinreceiver

import (
"fmt"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
)
Expand Down Expand Up @@ -47,7 +45,7 @@ func (c Client) Get(id string, params *stripe.BitcoinReceiverParams) (*stripe.Bi
}

bitcoinReceiver := &stripe.BitcoinReceiver{}
err := c.B.Call("GET", "/bitcoin/receivers/"+id, c.Key, nil, commonParams, bitcoinReceiver)
err := c.B.Call("GET", stripe.FormatURLPath("/bitcoin/receivers/%s", id), c.Key, nil, commonParams, bitcoinReceiver)

return bitcoinReceiver, err
}
Expand All @@ -63,7 +61,7 @@ func (c Client) Update(id string, params *stripe.BitcoinReceiverUpdateParams) (*
form.AppendTo(body, params)

receiver := &stripe.BitcoinReceiver{}
err := c.B.Call("POST", fmt.Sprintf("/bitcoin/receivers/%v", id), c.Key, body, &params.Params, receiver)
err := c.B.Call("POST", stripe.FormatURLPath("/bitcoin/receivers/%s", id), c.Key, body, &params.Params, receiver)

return receiver, err
}
Expand Down
4 changes: 1 addition & 3 deletions bitcointransaction/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
package bitcointransaction

import (
"fmt"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
)
Expand Down Expand Up @@ -34,7 +32,7 @@ func (c Client) List(params *stripe.BitcoinTransactionListParams) *Iter {

return &Iter{stripe.GetIter(lp, body, func(b *form.Values) ([]interface{}, stripe.ListMeta, error) {
list := &stripe.BitcoinTransactionList{}
err := c.B.Call("GET", fmt.Sprintf("/bitcoin/receivers/%v/transactions", stripe.StringValue(params.Receiver)), c.Key, b, p, list)
err := c.B.Call("GET", stripe.FormatURLPath("/bitcoin/receivers/%s/transactions", stripe.StringValue(params.Receiver)), c.Key, b, p, list)

ret := make([]interface{}, len(list.Data))
for i, v := range list.Data {
Expand Down
31 changes: 15 additions & 16 deletions card/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package card

import (
"errors"
"fmt"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
Expand Down Expand Up @@ -37,11 +36,11 @@ func (c Client) New(params *stripe.CardParams) (*stripe.Card, error) {
var err error

if params.Account != nil {
err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts", stripe.StringValue(params.Account)), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/accounts/%s/external_accounts", stripe.StringValue(params.Account)), c.Key, body, &params.Params, card)
} else if params.Customer != nil {
err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources", stripe.StringValue(params.Customer)), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/customers/%s/sources", stripe.StringValue(params.Customer)), c.Key, body, &params.Params, card)
} else if params.Recipient != nil {
err = c.B.Call("POST", fmt.Sprintf("/recipients/%v/cards", stripe.StringValue(params.Recipient)), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/recipients/%s/cards", stripe.StringValue(params.Recipient)), c.Key, body, &params.Params, card)
} else {
err = errors.New("Invalid card params: either account, customer or recipient need to be set")
}
Expand Down Expand Up @@ -73,11 +72,11 @@ func (c Client) Get(id string, params *stripe.CardParams) (*stripe.Card, error)
var err error

if params.Account != nil {
err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card)
err = c.B.Call("GET", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card)
} else if params.Customer != nil {
err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card)
err = c.B.Call("GET", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card)
} else if params.Recipient != nil {
err = c.B.Call("GET", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card)
err = c.B.Call("GET", stripe.FormatURLPath("/recipients/%s/cards/%s", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card)
} else {
err = errors.New("Invalid card params: either account, customer or recipient need to be set")
}
Expand All @@ -103,11 +102,11 @@ func (c Client) Update(id string, params *stripe.CardParams) (*stripe.Card, erro
var err error

if params.Account != nil {
err = c.B.Call("POST", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, &params.Params, card)
} else if params.Customer != nil {
err = c.B.Call("POST", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, &params.Params, card)
} else if params.Recipient != nil {
err = c.B.Call("POST", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, &params.Params, card)
err = c.B.Call("POST", stripe.FormatURLPath("/recipients/%s/cards/%s", stripe.StringValue(params.Recipient), id), c.Key, body, &params.Params, card)
} else {
err = errors.New("Invalid card params: either account, customer or recipient need to be set")
}
Expand Down Expand Up @@ -137,11 +136,11 @@ func (c Client) Del(id string, params *stripe.CardParams) (*stripe.Card, error)
var err error

if params.Account != nil {
err = c.B.Call("DELETE", fmt.Sprintf("/accounts/%v/external_accounts/%v", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card)
err = c.B.Call("DELETE", stripe.FormatURLPath("/accounts/%s/external_accounts/%s", stripe.StringValue(params.Account), id), c.Key, body, commonParams, card)
} else if params.Customer != nil {
err = c.B.Call("DELETE", fmt.Sprintf("/customers/%v/sources/%v", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card)
err = c.B.Call("DELETE", stripe.FormatURLPath("/customers/%s/sources/%s", stripe.StringValue(params.Customer), id), c.Key, body, commonParams, card)
} else if params.Recipient != nil {
err = c.B.Call("DELETE", fmt.Sprintf("/recipients/%v/cards/%v", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card)
err = c.B.Call("DELETE", stripe.FormatURLPath("/recipients/%s/cards/%s", stripe.StringValue(params.Recipient), id), c.Key, body, commonParams, card)
} else {
err = errors.New("Invalid card params: either account, customer or recipient need to be set")
}
Expand Down Expand Up @@ -175,11 +174,11 @@ func (c Client) List(params *stripe.CardListParams) *Iter {
}

if params.Account != nil {
err = c.B.Call("GET", fmt.Sprintf("/accounts/%v/external_accounts?object=card", stripe.StringValue(params.Account)), c.Key, b, p, list)
err = c.B.Call("GET", stripe.FormatURLPath("/accounts/%s/external_accounts?object=card", stripe.StringValue(params.Account)), c.Key, b, p, list)
} else if params.Customer != nil {
err = c.B.Call("GET", fmt.Sprintf("/customers/%v/sources?object=card", stripe.StringValue(params.Customer)), c.Key, b, p, list)
err = c.B.Call("GET", stripe.FormatURLPath("/customers/%s/sources?object=card", stripe.StringValue(params.Customer)), c.Key, b, p, list)
} else if params.Recipient != nil {
err = c.B.Call("GET", fmt.Sprintf("/recipients/%v/cards", stripe.StringValue(params.Recipient)), c.Key, b, p, list)
err = c.B.Call("GET", stripe.FormatURLPath("/recipients/%s/cards", stripe.StringValue(params.Recipient)), c.Key, b, p, list)
} else {
err = errors.New("Invalid card params: either account, customer or recipient need to be set")
}
Expand Down
12 changes: 5 additions & 7 deletions charge/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
package charge

import (
"fmt"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
)
Expand Down Expand Up @@ -47,7 +45,7 @@ func (c Client) Get(id string, params *stripe.ChargeParams) (*stripe.Charge, err
}

charge := &stripe.Charge{}
err := c.B.Call("GET", "/charges/"+id, c.Key, body, commonParams, charge)
err := c.B.Call("GET", stripe.FormatURLPath("/charges/%s", id), c.Key, body, commonParams, charge)

return charge, err
}
Expand All @@ -69,7 +67,7 @@ func (c Client) Update(id string, params *stripe.ChargeParams) (*stripe.Charge,
}

charge := &stripe.Charge{}
err := c.B.Call("POST", "/charges/"+id, c.Key, body, commonParams, charge)
err := c.B.Call("POST", stripe.FormatURLPath("/charges/%s", id), c.Key, body, commonParams, charge)

return charge, err
}
Expand All @@ -92,7 +90,7 @@ func (c Client) Capture(id string, params *stripe.CaptureParams) (*stripe.Charge

charge := &stripe.Charge{}

err := c.B.Call("POST", fmt.Sprintf("/charges/%v/capture", id), c.Key, body, commonParams, charge)
err := c.B.Call("POST", stripe.FormatURLPath("/charges/%s/capture", id), c.Key, body, commonParams, charge)

return charge, err
}
Expand Down Expand Up @@ -177,7 +175,7 @@ func (c Client) UpdateDispute(id string, params *stripe.DisputeParams) (*stripe.
}

dispute := &stripe.Dispute{}
err := c.B.Call("POST", fmt.Sprintf("/charges/%v/dispute", id), c.Key, body, commonParams, dispute)
err := c.B.Call("POST", stripe.FormatURLPath("/charges/%s/dispute", id), c.Key, body, commonParams, dispute)

return dispute, err
}
Expand All @@ -190,7 +188,7 @@ func CloseDispute(id string) (*stripe.Dispute, error) {

func (c Client) CloseDispute(id string) (*stripe.Dispute, error) {
dispute := &stripe.Dispute{}
err := c.B.Call("POST", fmt.Sprintf("/charges/%v/dispute/close", id), c.Key, nil, nil, dispute)
err := c.B.Call("POST", stripe.FormatURLPath("/charges/%s/dispute/close", id), c.Key, nil, nil, dispute)

return dispute, err
}
Expand Down
2 changes: 1 addition & 1 deletion countryspec/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func Get(country string) (*stripe.CountrySpec, error) {

func (c Client) Get(country string) (*stripe.CountrySpec, error) {
countrySpec := &stripe.CountrySpec{}
err := c.B.Call("GET", "/country_specs/"+country, c.Key, nil, nil, countrySpec)
err := c.B.Call("GET", stripe.FormatURLPath("/country_specs/%s", country), c.Key, nil, nil, countrySpec)

return countrySpec, err
}
Expand Down
8 changes: 3 additions & 5 deletions coupon/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
package coupon

import (
"net/url"

stripe "github.com/stripe/stripe-go"
"github.com/stripe/stripe-go/form"
)
Expand Down Expand Up @@ -48,7 +46,7 @@ func (c Client) Get(id string, params *stripe.CouponParams) (*stripe.Coupon, err

coupon := &stripe.Coupon{}

err := c.B.Call("GET", "/coupons/"+url.QueryEscape(id), c.Key, body, commonParams, coupon)
err := c.B.Call("GET", stripe.FormatURLPath("/coupons/%s", id), c.Key, body, commonParams, coupon)

return coupon, err
}
Expand All @@ -64,7 +62,7 @@ func (c Client) Update(id string, params *stripe.CouponParams) (*stripe.Coupon,
form.AppendTo(body, params)

coupon := &stripe.Coupon{}
err := c.B.Call("POST", "/coupons/"+url.QueryEscape(id), c.Key, body, &params.Params, coupon)
err := c.B.Call("POST", stripe.FormatURLPath("/coupons/%s", id), c.Key, body, &params.Params, coupon)

return coupon, err
}
Expand All @@ -86,7 +84,7 @@ func (c Client) Del(id string, params *stripe.CouponParams) (*stripe.Coupon, err
}

coupon := &stripe.Coupon{}
err := c.B.Call("DELETE", "/coupons/"+url.QueryEscape(id), c.Key, body, commonParams, coupon)
err := c.B.Call("DELETE", stripe.FormatURLPath("/coupons/%s", id), c.Key, body, commonParams, coupon)

return coupon, err
}
Expand Down
6 changes: 3 additions & 3 deletions customer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (c Client) Get(id string, params *stripe.CustomerParams) (*stripe.Customer,
}

cust := &stripe.Customer{}
err := c.B.Call("GET", "/customers/"+id, c.Key, body, commonParams, cust)
err := c.B.Call("GET", stripe.FormatURLPath("/customers/%s", id), c.Key, body, commonParams, cust)

return cust, err
}
Expand All @@ -73,7 +73,7 @@ func (c Client) Update(id string, params *stripe.CustomerParams) (*stripe.Custom
}

cust := &stripe.Customer{}
err := c.B.Call("POST", "/customers/"+id, c.Key, body, commonParams, cust)
err := c.B.Call("POST", stripe.FormatURLPath("/customers/%s", id), c.Key, body, commonParams, cust)

return cust, err
}
Expand All @@ -95,7 +95,7 @@ func (c Client) Del(id string, params *stripe.CustomerParams) (*stripe.Customer,
}

cust := &stripe.Customer{}
err := c.B.Call("DELETE", "/customers/"+id, c.Key, body, commonParams, cust)
err := c.B.Call("DELETE", stripe.FormatURLPath("/customers/%s", id), c.Key, body, commonParams, cust)

return cust, err
}
Expand Down
Loading

0 comments on commit 09d2c22

Please sign in to comment.