@bool-ts/core 1.5.1 → 1.5.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.
@@ -184,7 +184,7 @@ export const BoolFactory = (target, options) => {
184
184
  }
185
185
  if (!allowOrigins.includes(origin)) {
186
186
  return new Response(JSON.stringify({
187
- httpCode: 403,
187
+ httpCode: 400,
188
188
  message: "Origin not found.",
189
189
  data: {
190
190
  origin: {
@@ -193,12 +193,19 @@ export const BoolFactory = (target, options) => {
193
193
  }
194
194
  }
195
195
  }), {
196
- status: 403,
196
+ status: 400,
197
197
  statusText: "Invalid origin.",
198
198
  headers: resHeaders
199
199
  });
200
200
  }
201
201
  }
202
+ if (request.method.toUpperCase() === "OPTIONS") {
203
+ return new Response(undefined, {
204
+ status: 204,
205
+ statusText: "SUCCESS",
206
+ headers: resHeaders
207
+ });
208
+ }
202
209
  if (!allowMethods.includes(request.method.toUpperCase())) {
203
210
  throw new HttpClientError({
204
211
  httpCode: 405,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bool-ts/core",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -247,7 +247,7 @@ export const BoolFactory = (target: new (...args: any[]) => unknown, options: TB
247
247
  if (!allowOrigins.includes(origin)) {
248
248
  return new Response(
249
249
  JSON.stringify({
250
- httpCode: 403,
250
+ httpCode: 400,
251
251
  message: "Origin not found.",
252
252
  data: {
253
253
  origin: {
@@ -257,7 +257,7 @@ export const BoolFactory = (target: new (...args: any[]) => unknown, options: TB
257
257
  }
258
258
  }),
259
259
  {
260
- status: 403,
260
+ status: 400,
261
261
  statusText: "Invalid origin.",
262
262
  headers: resHeaders
263
263
  }
@@ -265,6 +265,14 @@ export const BoolFactory = (target: new (...args: any[]) => unknown, options: TB
265
265
  }
266
266
  }
267
267
 
268
+ if (request.method.toUpperCase() === "OPTIONS") {
269
+ return new Response(undefined, {
270
+ status: 204,
271
+ statusText: "SUCCESS",
272
+ headers: resHeaders
273
+ });
274
+ }
275
+
268
276
  if (!allowMethods.includes(request.method.toUpperCase())) {
269
277
  throw new HttpClientError({
270
278
  httpCode: 405,