@onebun/core 0.2.7 → 0.2.8
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/application/application.test.ts +6 -6
- package/src/application/application.ts +298 -210
- package/src/decorators/decorators.ts +213 -0
- package/src/docs-examples.test.ts +357 -2
- package/src/exception-filters/exception-filters.test.ts +172 -0
- package/src/exception-filters/exception-filters.ts +129 -0
- package/src/exception-filters/http-exception.ts +22 -0
- package/src/exception-filters/index.ts +2 -0
- package/src/file/onebun-file.ts +8 -2
- package/src/http-guards/http-guards.test.ts +230 -0
- package/src/http-guards/http-guards.ts +173 -0
- package/src/http-guards/index.ts +1 -0
- package/src/index.ts +9 -0
- package/src/module/module.test.ts +78 -0
- package/src/module/module.ts +37 -7
- package/src/security/cors-middleware.ts +212 -0
- package/src/security/index.ts +19 -0
- package/src/security/rate-limit-middleware.ts +276 -0
- package/src/security/security-headers-middleware.ts +188 -0
- package/src/security/security.test.ts +285 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/testing-module.test.ts +199 -0
- package/src/testing/testing-module.ts +252 -0
- package/src/types.ts +98 -0
package/package.json
CHANGED
|
@@ -1842,7 +1842,7 @@ describe('OneBunApplication', () => {
|
|
|
1842
1842
|
expect(body.result.hasOptional).toBe(false);
|
|
1843
1843
|
});
|
|
1844
1844
|
|
|
1845
|
-
test('should return
|
|
1845
|
+
test('should return 400 when required query parameter is missing', async () => {
|
|
1846
1846
|
@Controller('/api')
|
|
1847
1847
|
class ApiController extends BaseController {
|
|
1848
1848
|
@Get('/required-query')
|
|
@@ -1869,7 +1869,7 @@ describe('OneBunApplication', () => {
|
|
|
1869
1869
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1870
1870
|
const response = await (mockServer as any).fetchHandler(request);
|
|
1871
1871
|
|
|
1872
|
-
expect(response.status).toBe(
|
|
1872
|
+
expect(response.status).toBe(400);
|
|
1873
1873
|
});
|
|
1874
1874
|
|
|
1875
1875
|
test('should pass validation with required query parameter present', async () => {
|
|
@@ -1966,7 +1966,7 @@ describe('OneBunApplication', () => {
|
|
|
1966
1966
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1967
1967
|
const response = await (mockServer as any).fetchHandler(request);
|
|
1968
1968
|
|
|
1969
|
-
expect(response.status).toBe(
|
|
1969
|
+
expect(response.status).toBe(400);
|
|
1970
1970
|
});
|
|
1971
1971
|
|
|
1972
1972
|
test('should validate body with arktype schema', async () => {
|
|
@@ -2045,7 +2045,7 @@ describe('OneBunApplication', () => {
|
|
|
2045
2045
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2046
2046
|
const response = await (mockServer as any).fetchHandler(request);
|
|
2047
2047
|
|
|
2048
|
-
expect(response.status).toBe(
|
|
2048
|
+
expect(response.status).toBe(400);
|
|
2049
2049
|
});
|
|
2050
2050
|
|
|
2051
2051
|
test('should handle metrics endpoint', async () => {
|
|
@@ -3449,7 +3449,7 @@ describe('OneBunApplication', () => {
|
|
|
3449
3449
|
expect(body.result.isUndefined).toBe(true);
|
|
3450
3450
|
});
|
|
3451
3451
|
|
|
3452
|
-
test('should return
|
|
3452
|
+
test('should return 400 when required cookie is missing', async () => {
|
|
3453
3453
|
@Controller('/api')
|
|
3454
3454
|
class ApiController extends BaseController {
|
|
3455
3455
|
@Get('/auth')
|
|
@@ -3474,7 +3474,7 @@ describe('OneBunApplication', () => {
|
|
|
3474
3474
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3475
3475
|
const response = await (mockServer as any).fetchHandler(request);
|
|
3476
3476
|
|
|
3477
|
-
expect(response.status).toBe(
|
|
3477
|
+
expect(response.status).toBe(400);
|
|
3478
3478
|
});
|
|
3479
3479
|
|
|
3480
3480
|
test('should extract multiple cookies with @Cookie decorator', async () => {
|