pixl-server-web 2.0.7 → 2.0.8

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/lib/request.js +17 -4
  2. package/package.json +1 -1
package/lib/request.js CHANGED
@@ -564,11 +564,24 @@ module.exports = class Request {
564
564
  }
565
565
  else if (arguments[0] === true) {
566
566
  // true means handler sent the raw response itself
567
- self.logDebug(9, "Handler sent custom response");
568
- if (args.callback) {
569
- args.callback();
570
- delete args.callback;
567
+ args.resp_headers = { ...args.response.getHeaders() };
568
+
569
+ if (args.request.socket.destroyed) {
570
+ args.http_code = 0;
571
+ args.http_status = 'Socket Closed';
572
+ self.logDebug(9, "Socket closed during custom response");
571
573
  }
574
+ else {
575
+ args.http_code = args.response.statusCode || 0;
576
+ args.http_status = args.response.statusMessage || '';
577
+ self.logDebug(9, "Handler sent custom response", {
578
+ statusCode: args.http_code,
579
+ statusMessage: args.http_status,
580
+ headers: args.resp_headers
581
+ });
582
+ }
583
+
584
+ self.finishRequest(args);
572
585
  }
573
586
  else if (arguments[0] === false) {
574
587
  // false means handler did nothing, fall back to static
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixl-server-web",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "A web server component for the pixl-server framework.",
5
5
  "author": "Joseph Huckaby <jhuckaby@gmail.com>",
6
6
  "homepage": "https://github.com/jhuckaby/pixl-server-web",