From cf771e643b024d97fd90a4753c8565777f73b847 Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 11 May 2021 19:40:16 -0400 Subject: [PATCH] More succinct defaults --- lib/StripeResource.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/StripeResource.js b/lib/StripeResource.js index ab8168eef4..8161831421 100644 --- a/lib/StripeResource.js +++ b/lib/StripeResource.js @@ -106,21 +106,9 @@ StripeResource.prototype = { // For convenience, make some headers easily accessible on // lastResponse. res.requestId = headers['request-id']; - - const stripeAccount = headers['stripe-account']; - if (stripeAccount) { - res.stripeAccount = stripeAccount; - } - - const apiVersion = headers['stripe-version']; - if (apiVersion) { - res.apiVersion = apiVersion; - } - - const idempotencyKey = headers['idempotency-key']; - if (idempotencyKey) { - res.idempotencyKey = idempotencyKey; - } + res.stripeAccount = res.stripeAccount || headers['stripe-account']; + res.apiVersion = res.apiVersion || headers['stripe-version']; + res.idempotencyKey = res.idempotencyKey || headers['idempotency-key']; }, _makeResponseEvent(req, res, headers) {