Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karl-common-util

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karl-common-util - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

51

dist/http/index.js

@@ -63,17 +63,28 @@ "use strict";

//204和205没有返回内容
if (!(status === 204 || status === 205)) {
_context.next = 11;
break;
}
resolve({ status: status });
return _context.abrupt("return");
case 11:
//将返回结果解析为json
message = void 0;
_context.prev = 9;
_context.next = 12;
_context.prev = 12;
_context.next = 15;
return regeneratorRuntime.awrap(responese.json());
case 12:
case 15:
message = _context.sent;
_context.next = 19;
_context.next = 22;
break;
case 15:
_context.prev = 15;
_context.t0 = _context["catch"](9);
case 18:
_context.prev = 18;
_context.t0 = _context["catch"](12);

@@ -84,22 +95,24 @@ //结果类型不为json(例如nginx直接返回404错误)

case 19:
case 22:
_context.t1 = status;
_context.next = _context.t1 === 200 ? 22 : _context.t1 === 201 ? 22 : _context.t1 === 202 ? 22 : _context.t1 === 204 ? 22 : _context.t1 === 401 ? 24 : 27;
_context.next = _context.t1 === 200 ? 25 : _context.t1 === 201 ? 25 : _context.t1 === 202 ? 25 : _context.t1 === 204 ? 25 : _context.t1 === 401 ? 27 : 30;
break;
case 22:
case 25:
resolve({ status: status, message: message });
return _context.abrupt("break", 29);
return _context.abrupt("break", 32);
case 24:
case 27:
//请求未授权,重新登录
location.href = "../login/";
if (location !== undefined) {
location.href = "../login/";
}
reject({ status: 401, message: "重新登录" });
return _context.abrupt("break", 29);
return _context.abrupt("break", 32);
case 27:
case 30:
reject({ status: status, message: message });
return _context.abrupt("break", 29);
return _context.abrupt("break", 32);
case 29:
case 32:
case "end":

@@ -109,3 +122,3 @@ return _context.stop();

}
}, null, undefined, [[9, 15]]);
}, null, undefined, [[12, 18]]);
});

@@ -112,0 +125,0 @@ return _context2.abrupt("return", promise);

{
"name": "karl-common-util",
"version": "1.2.1",
"version": "1.2.2",
"description": "karl common lib for client and server",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -31,2 +31,8 @@ import "isomorphic-fetch"

//204和205没有返回内容
if (status === 204 || status === 205) {
resolve({status: status})
return
}
//将返回结果解析为json

@@ -52,3 +58,5 @@ let message

//请求未授权,重新登录
location.href = "../login/"
if (location !== undefined) {
location.href = "../login/"
}
reject({status: 401, message: "重新登录"})

@@ -55,0 +63,0 @@ break

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc