@mauribadnights/clooks 0.6.0 → 0.6.1
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/dist/server.js +9 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -91,11 +91,15 @@ function readBody(req) {
|
|
|
91
91
|
}
|
|
92
92
|
function sendJson(res, status, data) {
|
|
93
93
|
const body = JSON.stringify(data);
|
|
94
|
-
res.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
res.socket?.on('error', () => { }); // suppress EPIPE if client disconnected early
|
|
95
|
+
try {
|
|
96
|
+
res.writeHead(status, {
|
|
97
|
+
'Content-Type': 'application/json',
|
|
98
|
+
'Content-Length': Buffer.byteLength(body),
|
|
99
|
+
});
|
|
100
|
+
res.end(body);
|
|
101
|
+
}
|
|
102
|
+
catch (_) { }
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* Create the HTTP server for hook handling.
|
package/package.json
CHANGED