whistle.pastekitlab 1.5.2 → 1.5.3

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.
Files changed (2) hide show
  1. package/index.js +10 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -139,13 +139,13 @@ function broadcast(type, data) {
139
139
  module.exports = (server, options) => {
140
140
  log('插件已启动(使用 request/response 钩子)');
141
141
  startWebSocketServer();
142
- // server.on('request', (req, res) => {
143
- // console.log('>>> [GLOBAL]', req.fullUrl);
144
- // });
142
+ server.on('request', (req, res) => {
143
+ console.log('>>> [GLOBAL]', req.fullUrl);
144
+ });
145
145
 
146
146
  return {
147
147
  // ✅ 监听请求
148
- request: (req, res) => {
148
+ request: (req, res,next) => {
149
149
  try {
150
150
  console.info("req:" + JSON.stringify(req))
151
151
  const url = req.fullUrl || req.url;
@@ -168,18 +168,18 @@ module.exports = (server, options) => {
168
168
  } catch (e) {
169
169
  log('request error: ' + e.message);
170
170
  }
171
- // next(); // ⚠️ 必须调用!
171
+ next(); // ⚠️ 必须调用!
172
172
  },
173
173
 
174
174
  // ✅ 监听响应
175
- response: (req, res) => {
175
+ response: (req, res,next) => {
176
176
  try {
177
177
  console.info("rsp:" + JSON.stringify(req))
178
178
 
179
179
  const url = req.fullUrl || req.url;
180
- // if (!shouldIntercept(url)) {
181
- // return next();
182
- // }
180
+ if (!shouldIntercept(url)) {
181
+ return next();
182
+ }
183
183
 
184
184
  const data = {
185
185
  eventId: generateId(),
@@ -197,7 +197,7 @@ module.exports = (server, options) => {
197
197
  } catch (e) {
198
198
  log('response error: ' + e.message);
199
199
  }
200
- // next(); // ⚠️ 必须调用!
200
+ next(); // ⚠️ 必须调用!
201
201
  }
202
202
  };
203
203
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistle.pastekitlab",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Whistle plugin for PasteKit Lab - Intercepts requests and sends them to requestlistviewer via WebSocket",
5
5
  "main": "index.js",
6
6
  "scripts": {