-
Notifications
You must be signed in to change notification settings - Fork 759
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 #406
Comments
assigning to @jlomas-stripe who built the feature originally in #366 |
Thanks! And yeah, it seems fine to me to expose |
@sedouard You can already get the @brandur it might make sense to expose anything that we allow providing, maybe as:
Or alternatively, we could just put in the things we know will be there, or even just straight up make it match whatever comes out in |
Personally I like the idea of matching what comes out of |
I think it'd probably be already to add an |
So on @brandur-stripe's point the current ' {
api_version: 'latest',
account: 'acct_TEST', // Only present if provided
idempotency_key: 'abc123', // Only present if provided
method: 'POST',
path: '/v1/charges',
status: 402,
request_id: 'req_Ghc9r26ts73DRf',
elapsed: 445 // Elapsed time in milliseconds
} However I think it would be great to model |
+1. |
Welp, I fell off the world apparently. ¯\_(ツ)_/¯ If I recall correctly, I modeled these on the parameter names that get provided, rather than camelCasing them as one would normally see in Node. At this point, I'd say switching up the events' property names would be a breaking change, so I'm not sure if it's something that could/should be done here? That said, adding I also wonder if |
Per magical conversations elsewhere - and to remind myself for when I finally do this - I'm planning on adding the following to
|
Sorry about the hugely delayed response here Jonathan, but yep, that sounds good to me. |
Hello! 👋 I've tried to do this in #952, hope it's still relevant... Let me know if this isn't meant for an external contributor, though - that's totally fine too! :) |
Resolved in #952! |
On a successful API request the Stripe Node SDK doesn't provide a natural way of accessing response headers which can be useful in the case you're interested in response metadata (such as
Idempotency-Key
andRequest-ID
.For example today it is possible to do this but it is a little bit awkward since response metadata is exposed through an event emitter interface, while the response body is exposed through a callback interface:
It would be a much better experience if this data was passed in the callback like so:
My idea is that we add headers, statusCode and known Stripe headers such as
idempotencyKey
to go along withrequestId
to StripeResource hereThoughts?
The text was updated successfully, but these errors were encountered: