From e6a2cc1b00fdaef148af464cea80c27ff14e8d80 Mon Sep 17 00:00:00 2001 From: TheNorthMemory Date: Thu, 25 Aug 2022 15:39:56 +0800 Subject: [PATCH] bump to v0.8.6 fix cannot replacement more than one `uri_template` variables issue --- CHANGELOG.md | 2 ++ lib/decorator.js | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index deb3f2b..f0b51d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # 变更历史 +## v0.8.6 (2022-08-25) +- 修复多个 `uri_template` 占位符变量,无法正确替换问题; ## v0.8.5 (2022-03-09) - 优化`README`,增加v2版付款到零钱示例不验签使用方法; - 解决`CLI`下初始化参数`mchid`必须是字符串类型的遗留问题; diff --git a/lib/decorator.js b/lib/decorator.js index a75aa37..670dcca 100644 --- a/lib/decorator.js +++ b/lib/decorator.js @@ -244,7 +244,7 @@ class Decorator { * @returns {PromiseLike} - The `AxiosPromise` */ request(pathname, method, data, config) { - const url = pathname.replace(/\{(.+)\}/g, (tmpl, named) => (Object.prototype.hasOwnProperty.call(config, named) ? config[named] : tmpl)); + const url = pathname.replace(/\{([^}]+)\}/g, (tmpl, named) => (Object.prototype.hasOwnProperty.call(config, named) ? config[named] : tmpl)); debuglog('prepared url: %s, method: %s, data: %o, config: %o', url, method, data, config); diff --git a/package.json b/package.json index ff824f9..73611ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wechatpay-axios-plugin", - "version": "0.8.5", + "version": "0.8.6", "description": "微信支付APIv2及v3 NodeJS SDK,支持CLI模式请求OpenAPI,支持v3证书下载,v2付款码支付、企业付款、退款,企业微信-企业支付-企业红包/向员工付款,v2&v3 Native支付、扫码支付、H5支付、JSAPI/小程序支付、合单支付...", "main": "index.js", "typings": "index.d.ts",