-
-
Notifications
You must be signed in to change notification settings - Fork 3
Adds option to disable response validation #545
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
Conversation
Allows disabling response validation by introducing a `validateResponse` option. This provides flexibility for situations where response validation is not required or desired, such as during development or in performance-critical scenarios. Response validation is enabled by default.
📝 WalkthroughWalkthroughThis pull request introduces a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a validateResponse configuration option to allow disabling response validation when needed. Response validation is enabled by default to maintain backward compatibility. The feature provides flexibility for development or performance-critical scenarios where response validation overhead is not desired.
Changes:
- Added
validateResponseboolean option to the Api class and setupRouter function with a default value oftrue - Modified router to conditionally register the
postResponseHandlerbased on thevalidateResponseflag - Added comprehensive test coverage for all three scenarios: explicitly disabled, explicitly enabled, and default behavior
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/api.js | Added validateResponse property to the Api class with JSDoc documentation, constructor parameter handling, and pass-through to setupRouter |
| src/router.js | Added validateResponse parameter with default value true and conditional registration of postResponseHandler based on the flag |
| src/router.test.js | Added three test cases covering validateResponse=false, validateResponse=true, and default behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Allows disabling response validation by introducing a
validateResponseoption.This provides flexibility for situations where response validation is not required or desired, such as during development or in performance-critical scenarios.
Response validation is enabled by default.
Summary by CodeRabbit
Release Notes
New Features
Tests