@pbvision/fastify-firestore-service 0.0.42 → 0.0.43
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/api/api.js +10 -2
package/package.json
CHANGED
package/src/api/api.js
CHANGED
|
@@ -258,9 +258,13 @@ class API {
|
|
|
258
258
|
* @private
|
|
259
259
|
*/
|
|
260
260
|
__setCORSHeaders (origin, headers) {
|
|
261
|
-
this.
|
|
261
|
+
this.constructor.setCORSHeadersOnReply(this.__reply, origin, headers)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
static setCORSHeadersOnReply (reply, origin, headers) {
|
|
265
|
+
reply.header('Access-Control-Allow-Origin', origin)
|
|
262
266
|
if (headers && headers.length) {
|
|
263
|
-
|
|
267
|
+
reply.header('Access-Control-Allow-Headers', headers.join(', '))
|
|
264
268
|
}
|
|
265
269
|
}
|
|
266
270
|
|
|
@@ -807,6 +811,10 @@ class API {
|
|
|
807
811
|
// istanbul ignore next
|
|
808
812
|
console.warn('trying to get inputs to track failed', err)
|
|
809
813
|
}
|
|
814
|
+
if (this.CORS_ORIGIN) {
|
|
815
|
+
this.setCORSHeadersOnReply(
|
|
816
|
+
reply, this.getCORSOrigin(), this.CORS_HEADERS)
|
|
817
|
+
}
|
|
810
818
|
throw new InvalidInputException(req.validationError)
|
|
811
819
|
}
|
|
812
820
|
ret = await this._callAndHandleRequestDone(reply, async () => {
|