Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): add response guard #1542

Merged
merged 2 commits into from
Jul 15, 2022
Merged

feat(core): add response guard #1542

merged 2 commits into from
Jul 15, 2022

Conversation

gao-sun
Copy link
Member

@gao-sun gao-sun commented Jul 14, 2022

Summary

  • add response and status guard to koaGuard()
  • guard /api/status status 204
  • guard /api/logs/:id body
  • auto generate DB schema zod guard

Testing

  • local admin console works
  • /api/status with wrong status responds 500
  • /api/logs/:id with wrong response responds 500
  • unit tests

@github-actions
Copy link

github-actions bot commented Jul 14, 2022

COMPARE TO master

Total Size Diff 📈 +1.82 KB

Diff by File
Name Diff
packages/core/src/errors/ServerError/index.ts 📈 +75 Bytes
packages/core/src/middleware/koa-error-handler.test.ts 📈 +13 Bytes
packages/core/src/middleware/koa-error-handler.ts 📈 +195 Bytes
packages/core/src/middleware/koa-guard.ts 📈 +643 Bytes
packages/core/src/routes/log.test.ts 📈 +91 Bytes
packages/core/src/routes/log.ts 📈 +61 Bytes
packages/core/src/routes/status.ts 📈 +75 Bytes
packages/schemas/src/foundations/schemas.ts 📈 +149 Bytes
packages/schemas/src/gen/index.ts 📈 +15 Bytes
packages/schemas/src/gen/schema.ts 📈 +549 Bytes

@gao-sun gao-sun force-pushed the gao-add-api-response-guard branch from d45234e to f3a9875 Compare July 15, 2022 08:55
@gao-sun gao-sun merged commit 6c39790 into master Jul 15, 2022
@gao-sun gao-sun deleted the gao-add-api-response-guard branch July 15, 2022 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants