Closed xavdid-stripe closed 1 month ago
@jar-stripe updated the comment, test string body, and extra HTTP method validation in https://github.com/stripe/stripe-go/pull/1924/commits/a05ed2d66ee340ab603a045e3de9e98f2a522154! I noticed that CallRaw
was actually a different call path and could use validation as well.
Why?
As the v2 API is releasing soon, we want Go to be able to make requests against the new endpoints despite not having generated types.
What
This is a copy/paste of https://github.com/stripe/stripe-go/pull/1648 with a few key differences:
APIMode
constants from"preview"
and"standard"
to"v1"
and"v2"
Because we no longer needed to supply default values for API mode, I could remove the function that handled that. I also adjusted tests that assumed you could set
content-type
andv1
/v2
independently (given that all v1 requests are form encoded and all v2 request are json).Manual Testing
myfolder
myfolder/go.mod
, paste:myfolder/main.go
paste:Running that (with valid customer id and event name) should print 2 response bodies
See Also