Skip to content

fix: updatePaymentMethod should use PUT instead of POST - #35

Open
mateussiqueira wants to merge 1 commit into
iugu:masterfrom
mateussiqueira:fix/updatePaymentMethod-put
Open

fix: updatePaymentMethod should use PUT instead of POST#35
mateussiqueira wants to merge 1 commit into
iugu:masterfrom
mateussiqueira:fix/updatePaymentMethod-put

Conversation

@mateussiqueira

Copy link
Copy Markdown

Description

updatePaymentMethod was sending an HTTP POST request, but updating an existing resource should use PUT. The Iugu API expects PUT for this endpoint.

This has been wrong since the method was first implemented (2016). POST to this endpoint would either fail silently or create unexpected behavior depending on how the API routed it.

Changes

lib/resources/Customers.js:34 — changed method: "POST" to method: "PUT"

Closes #17
Closes #20

The Iugu API expects an HTTP PUT request for updating a payment
method, not POST. POST should only be used for creating resources.

Closes iugu#17
Closes iugu#20
@mateussiqueira

Copy link
Copy Markdown
Author

Follow-up: algum feedback sobre o PR? A mudança de POST para PUT no updatePaymentMethod resolve dois issues abertos (#17 de 2016 e #20 de 2020).

Testei localmente e o PUT funciona conforme a documentação oficial da IUGU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update method should be PUT updatePaymentMethod should be PUT instead of POST

1 participant