socket-function 0.7.9 → 0.7.10
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 +1 -1
- package/src/callHTTPHandler.ts +6 -1
package/package.json
CHANGED
package/src/callHTTPHandler.ts
CHANGED
|
@@ -156,15 +156,20 @@ export async function httpCallHandler(request: http.IncomingMessage, response: h
|
|
|
156
156
|
for (let headerName in headers) {
|
|
157
157
|
response.setHeader(headerName, headers[headerName]);
|
|
158
158
|
}
|
|
159
|
+
let status = headers["status"];
|
|
160
|
+
if (status) {
|
|
161
|
+
response.writeHead(+status);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
159
164
|
}
|
|
160
165
|
response.write(result);
|
|
161
166
|
} else {
|
|
162
167
|
response.write(JSON.stringify(result));
|
|
163
168
|
}
|
|
164
|
-
response.end();
|
|
165
169
|
} catch (e: any) {
|
|
166
170
|
console.error(`Request error`, e.stack);
|
|
167
171
|
response.writeHead(500, String(e.message));
|
|
172
|
+
} finally {
|
|
168
173
|
response.end();
|
|
169
174
|
}
|
|
170
175
|
}
|