just-another-http-api 1.4.1 → 1.4.2

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/api.js CHANGED
@@ -163,6 +163,7 @@ function handleResponse ( reply, response, method, path ) {
163
163
  }
164
164
 
165
165
  setResponseHeaders ( reply, response );
166
+ setResponseCookies ( reply, response );
166
167
  handleSpecialResponseTypes ( reply, response, method, path );
167
168
  }
168
169
 
@@ -174,6 +175,16 @@ function setResponseHeaders ( reply, response ) {
174
175
  }
175
176
  }
176
177
 
178
+ function setResponseCookies ( reply, response ) {
179
+ if (response.cookies) {
180
+ Object.entries(response.cookies).forEach(([name, cookieVal]) => {
181
+ if (cookieVal && 'value' in cookieVal) {
182
+ reply.setCookie(name, cookieVal.value, cookieVal.options || {});
183
+ }
184
+ });
185
+ }
186
+ }
187
+
177
188
  function handleSpecialResponseTypes ( reply, response, method, path ) {
178
189
  if ( response.redirect ) {
179
190
  reply.redirect ( 301, response.redirect.url );
package/config/default.js CHANGED
@@ -4,4 +4,4 @@ module.exports = {
4
4
  host: process.env.REDIS_HOST || 'localhost',
5
5
  prefix: process.env.REDIS_PREFIX || 'api:'
6
6
  }
7
- };
7
+ };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "just-another-http-api",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "A framework built on top of fastify aimed at removing the need for any network or server configuration. ",
5
5
  "homepage": "https://github.com/OllieEdge/just-another-http-api#readme",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/OllieEdge/just-another-http-api.git"
8
+ "url": "git+https://github.com/OllieEdge/just-another-http-api.git"
9
9
  },
10
10
  "main": "api.js",
11
11
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "@fastify/websocket": "^10.0.1",
35
35
  "abstract-cache": "^1.0.1",
36
36
  "abstract-cache-redis": "^2.0.0",
37
- "eip-cloud-services": "^1.1.9",
37
+ "eip-cloud-services": "^1.2.3",
38
38
  "fastify": "^4.27.0",
39
39
  "fastify-multer": "^2.0.3",
40
40
  "recursive-readdir": "^2.2.3"