@trenskow/app-express 0.0.21 → 0.0.23

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.
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "cSpell.words": [
3
3
  "caseit"
4
- ]
4
+ ],
5
+ "[javascript]": {
6
+ "editor.formatOnSave": true,
7
+ "editor.formatOnPaste": true
8
+ }
5
9
  }
package/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // index.js
3
3
  // @trenskow/app-express
4
- //
4
+ //
5
5
  // Created by Kristian Trenskow on 2022/07/26
6
6
  // For license see LICENSE.
7
7
  //
@@ -53,6 +53,23 @@ export default ({ Router, util: { resolveInlineImport } }) => {
53
53
  return response.send(JSON.stringify(json));
54
54
  };
55
55
 
56
+ response.set = (name, value) => {
57
+
58
+ if (typeof name === 'object' && name !== null) {
59
+
60
+ const obj = name;
61
+
62
+ return Object.keys(obj)
63
+ .forEach((name) => {
64
+ response.set(name, value);
65
+ });
66
+
67
+ }
68
+
69
+ response.setHeader(name, value);
70
+
71
+ };
72
+
56
73
  router(request, response, (error) => {
57
74
 
58
75
  response.removeListener('writeHead', writeHeadEventHandler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/app-express",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "A plugin for `@trenskow/app` that allows for using routes for express.`",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,8 +23,9 @@
23
23
  },
24
24
  "homepage": "https://github.com/trenskow/app-express#readme",
25
25
  "devDependencies": {
26
- "@trenskow/app": "^0.8.8",
26
+ "@trenskow/app": "^0.8.9",
27
27
  "chai": "^4.3.7",
28
+ "eslint": "^8.47.0",
28
29
  "mocha": "^10.2.0",
29
30
  "supertest": "^6.3.3"
30
31
  },