Repository navigation
Preserve endpointFetch response headers - #2848
akalinin-stripe wants to merge 1 commit into
Conversation
Committed-By-Agent: codex Co-authored-by: codex <[email protected]>
ratomirjovanovic
left a comment
There was a problem hiding this comment.
Small, focused change, and passing these through is useful. Two notes.
The changelog line mentions retry signals. stripe-should-retry is now honored for endpointFetch responses, since _shouldRetry reads it from getHeaders(), but retry-after only reaches error.headers: _getSleepTimeInMS does not read it, so it does not change the backoff. Worth wording the changelog so nobody expects the delay to follow retry-after.
|
|
||
| constructor(res: EndpointFetchResponse) { | ||
| super(res.status, {}); | ||
| super(res.status, res.headers ?? {}); |
There was a problem hiding this comment.
RequestSender looks these up by lowercase key (request-id, stripe-should-retry, stripe-account, idempotency-key, stripe-notice). The other clients get lowercase names for free: Node's http lowercases them, and FetchHttpClient builds the object from a Headers instance. Here res.headers is a plain record, so if the runtime ever returns Request-Id or Stripe-Should-Retry, every lookup misses without an error. Lowercasing the keys once here (and for the rejection path on line 124) would make that independent of the runtime, and a test with mixed-case names would pin it.
Why?
EndpointFetchHttpClientcurrently replaces response headers with an empty object. This prevents response metadata and retry signals returned byendpointFetchfrom reaching stripe-node responses and errors.What?
endpointFetchcalls.retry-afteron Stripe API errors.Test Plan
tsc -p tsconfig.cjs.json --pretty falsemocha test/net/EndpointFetchHttpClient.spec.ts test/ExtensibilityPlatformFunctions.spec.tsChangelog
endpointFetchin extensibility runtimes.