abler-api 0.1.46 → 0.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -50,7 +50,7 @@ class apiUtil$2 {
50
50
  static testFlag = ppUtil$4.newGuid();
51
51
  static envId_dev = "?";
52
52
  static _validateBasicAuth = function (userName, password) {
53
- throw new Error('未设置基本验证函数');
53
+ throw new Error('no basic auth validator');
54
54
  }; // static apiCallRecSaver;
55
55
 
56
56
  static config(appConfig, appErrCfg, appDbSql) {
@@ -1429,8 +1429,14 @@ class apiUtil$2 {
1429
1429
  return res.sendStatus(401);
1430
1430
  }
1431
1431
  } catch (e) {
1432
- res.set('WWW-Authenticate', `Basic realm=${e.message}`);
1433
- return res.sendStatus(401);
1432
+ if (e.statusCode === 401) {
1433
+ try {
1434
+ res.set('WWW-Authenticate', `Basic realm=${e.message}`);
1435
+ return res.sendStatus(401);
1436
+ } catch {}
1437
+ }
1438
+
1439
+ return res.send(err$2.ERROR(e));
1434
1440
  }
1435
1441
 
1436
1442
  return next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "abler-api",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "API服务相关工具",
5
5
  "main": "./dist/cjs/pp-util.js",
6
6
  "-module": "./dist/es/pp-util.js",