socket-function 1.2.33 → 1.2.34

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "1.2.33",
3
+ "version": "1.2.34",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -146,9 +146,14 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
146
146
 
147
147
  let protocol = "https";
148
148
  let url = protocol + "://" + request.headers.host + request.url;
149
+ let loggingURL = url;
150
+ try {
151
+ loggingURL = new URL(urlBase).origin;
152
+ } catch { }
153
+
149
154
 
150
155
  if (SocketFunction.logMessages) {
151
- console.log(`HTTP request (${request.method}) ${url}`);
156
+ console.log(`HTTP request (${request.method}) ${loggingURL}`);
152
157
  }
153
158
  let urlObj = new URL(url);
154
159
 
@@ -216,7 +221,9 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
216
221
  response.setHeader("ETag", hash);
217
222
  if (request.headers["if-none-match"] === hash) {
218
223
  response.writeHead(304);
219
- console.log(`CACHED Immutable HTTP response (${request.method}) ${url}`);
224
+ if (SocketFunction.logMessages) {
225
+ console.log(`CACHED Immutable HTTP response (${request.method}) ${loggingURL}`);
226
+ }
220
227
  return;
221
228
  }
222
229
  }
@@ -249,7 +256,9 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
249
256
  response.setHeader("ETag", hash);
250
257
  if (request.headers["if-none-match"] === hash) {
251
258
  response.writeHead(304);
252
- console.log(`CACHED HTTP response ${formatNumberSuffixed(resultBuffer.length)}B (${request.method}) ${url}`);
259
+ if (SocketFunction.logMessages) {
260
+ console.log(`CACHED HTTP response ${formatNumberSuffixed(resultBuffer.length)}B (${request.method}) ${loggingURL}`);
261
+ }
253
262
  return;
254
263
  }
255
264
  }
@@ -297,7 +306,7 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
297
306
  }
298
307
  response.write(resultBuffer);
299
308
  if (SocketFunction.logMessages) {
300
- console.log(`HTTP response ${formatNumberSuffixed(resultBuffer.length)}B (${request.method}) ${url}`);
309
+ console.log(`HTTP response ${formatNumberSuffixed(resultBuffer.length)}B (${request.method}) ${loggingURL}`);
301
310
  }
302
311
 
303
312
  } catch (e: any) {