@nattyjs/express 0.0.1-beta.30 → 0.0.1-beta.31

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/index.cjs CHANGED
@@ -26,7 +26,9 @@ async function getRequestBodyInfo(request) {
26
26
 
27
27
  function getResponse(expressResponse, responseInfo) {
28
28
  if (responseInfo.headers)
29
- Object.keys(responseInfo.headers).forEach((key) => expressResponse.set(key, responseInfo.headers[key]));
29
+ for (const pair of responseInfo.headers.entries()) {
30
+ expressResponse.setHeader(pair[0], pair[1]);
31
+ }
30
32
  if (responseInfo.cookies)
31
33
  responseInfo.cookies.forEach((cookie) => {
32
34
  const name = cookie.name;
@@ -38,7 +40,9 @@ function getResponse(expressResponse, responseInfo) {
38
40
  expressResponse.statusCode = responseInfo.status;
39
41
  if (responseInfo.body && responseInfo.body.json) {
40
42
  expressResponse.send(responseInfo.body.json);
41
- } else
43
+ } else if (responseInfo.body && responseInfo.body.buffer)
44
+ expressResponse.send(responseInfo.body.buffer);
45
+ else
42
46
  expressResponse.send();
43
47
  return expressResponse;
44
48
  }
package/dist/index.mjs CHANGED
@@ -18,7 +18,9 @@ async function getRequestBodyInfo(request) {
18
18
 
19
19
  function getResponse(expressResponse, responseInfo) {
20
20
  if (responseInfo.headers)
21
- Object.keys(responseInfo.headers).forEach((key) => expressResponse.set(key, responseInfo.headers[key]));
21
+ for (const pair of responseInfo.headers.entries()) {
22
+ expressResponse.setHeader(pair[0], pair[1]);
23
+ }
22
24
  if (responseInfo.cookies)
23
25
  responseInfo.cookies.forEach((cookie) => {
24
26
  const name = cookie.name;
@@ -30,7 +32,9 @@ function getResponse(expressResponse, responseInfo) {
30
32
  expressResponse.statusCode = responseInfo.status;
31
33
  if (responseInfo.body && responseInfo.body.json) {
32
34
  expressResponse.send(responseInfo.body.json);
33
- } else
35
+ } else if (responseInfo.body && responseInfo.body.buffer)
36
+ expressResponse.send(responseInfo.body.buffer);
37
+ else
34
38
  expressResponse.send();
35
39
  return expressResponse;
36
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattyjs/express",
3
- "version": "0.0.1-beta.30",
3
+ "version": "0.0.1-beta.31",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "ajayojha <ojhaajay@outlook.com>",
@@ -18,9 +18,9 @@
18
18
  "express": "4.18.2",
19
19
  "cors": "2.8.5",
20
20
  "compression": "1.7.4",
21
- "@nattyjs/core": "0.0.1-beta.30",
22
- "@nattyjs/common": "0.0.1-beta.30",
23
- "@nattyjs/types": "0.0.1-beta.30"
21
+ "@nattyjs/core": "0.0.1-beta.31",
22
+ "@nattyjs/common": "0.0.1-beta.31",
23
+ "@nattyjs/types": "0.0.1-beta.31"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "20.3.1",