-
Notifications
You must be signed in to change notification settings - Fork 362
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
Better Access to Response Headers #420
Comments
+1. I'd prefer to add something like a |
Agreed that we should just expose the response instead of cherry picking things out of the response. @brandur-stripe - Where are you suggesting |
(also feel free to assign this to me as I'm happy to do a PR here) |
Yeah, I think that's plausible given that we already have something similar in stripe-node, and it'd be suitable for most people's needs. That said, it might also be a good idea just to spend a few minutes thinking about alternatives just in case there's something better that we could do.
Reusing Just off the top of my head:
And once again, coordinate with Olivier and company first, but it would be awesome if you could take this. |
@ob-stripe throw out a quick pr #421. Let's discuss the details there. |
Implemented in #421 and released in v5.24.0. |
On a successful API request the Stripe Java SDK doesn't provide a way of accessing response headers. (At least not that I can tell).
This can be useful in the case you're interested in response metadata (such as Idempotency-Key and Request-ID).
For example in a GET /customers/:id request:
The model doesn't provide any way to grab response headers from a given request (at least from what I can tell). However StripeResponse which the model is serialized from does.
It would be great if the experience could allow an optional way to include request metadata in the model response. Something like this:
Because nearly all StripeObjects represent some kind of API response, I'm thinking it's a good place to add a private
headers
field plus getters/setters.Afterwards depending on some kind of optional flag, we can include these headers to the serialized response model by safely casting to a StripeObject and setting it within the _request method inside of LiveStripeResponseGetter.
Would love to hear your thoughts.
The text was updated successfully, but these errors were encountered: