From b12955da8b6015f698dc69ef6fd0cf30b91856f9 Mon Sep 17 00:00:00 2001 From: chrisftian Date: Thu, 25 Jul 2024 14:37:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=20x-cos-sdk-retry=20?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=A4=B4=20(#213)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- sdk/base.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index cd511de..5ec3c01 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cos-nodejs-sdk-v5", - "version": "2.14.3", + "version": "2.14.4", "description": "cos nodejs sdk v5", "main": "index.js", "types": "index.d.ts", diff --git a/sdk/base.js b/sdk/base.js index f32fbe2..b076b9c 100644 --- a/sdk/base.js +++ b/sdk/base.js @@ -4034,6 +4034,7 @@ function submitRequest(params, callback) { networkError, }); params.SwitchHost = switchHost; + params.retry = true; next(tryTimes + 1); } else { if (err && params.Action === 'name/cos:UploadPart') { @@ -4127,6 +4128,9 @@ function _submitRequest(params, callback) { // 清理 undefined 和 null 字段 opt.headers && (opt.headers = util.clearKey(opt.headers)); + if (params.retry) { + opt.headers['x-cos-sdk-retry'] = true; + } opt = util.clearKey(opt); var Ip = this.options.Ip;