-
Notifications
You must be signed in to change notification settings - Fork 776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new fields to lastResponse: apiVersion, stripeAccount, idempotencyKey #952
Conversation
They are set from the headers only if the relevant header is present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @polybuildr -- thanks for the contribution!
This looks good. One request: can we avoid adding the new dev dependency on uuid
in the test? Hardcoding an identifier would be better.
Hi @richardm-stripe! I'm glad you brought that up! I started with hardcoding the key but then came across a problem. The test isn't hermetic and actually communicates with the Stripe API, so if I hardcode an idempotency key, running the test twice gives me an error saying: I'm not sure why it's that error specifically -- I didn't investigate. I can look into it later if you don't already know off the top of your head. |
Ah thanks @polybuildr, I forgot about that. Can we roll our own random identifier instead of introducing a dependency? |
Ah yes, that's a reasonably good solution. I'll update to include a random identifier without using a dependency. :) |
Also refactor existing test for some lastResponse fields.
a4b4b37
to
80f8803
Compare
Done! I know it doesn't matter, but I was still uncomfortable using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, this looks great. We are very excited about and appreciative of the contributions you are making to this repo & stripe-cli!
Released in 8.74.0 |
Thanks for the review! Glad to be of help. :) |
…yKey (stripe#952) * Add stripeAccount, apiVersion and idempotencyKey to lastResponse
…yKey (stripe#952) * Add stripeAccount, apiVersion and idempotencyKey to lastResponse
r? @jlomas-stripe
cc @stripe/api-libraries @brandur-stripe
If any of these three fields are set in the headers, copy them over to lastResponse as suggested in #406.
Also add tests for the new fields and refactor an existing test for lastResponse.