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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "socket-function",
3
- "version": "0.7.9",
3
+ "version": "0.7.10",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -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
  }