-
Notifications
You must be signed in to change notification settings - Fork 1
Exclude OPTIONS requests #24
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
WalkthroughThe changes update request handling logic to exclude HTTP OPTIONS and HEAD methods from certain processing. The filter now bypasses processing for OPTIONS requests, and utility logic ignores OPTIONS and HEAD when generating path data. No public API signatures were modified. Changes
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/java/io/apitally/spring/ApitallyFilter.java (1)
45-48: Consider using RequestMethod enum for consistency.The OPTIONS exclusion logic is correct and follows the existing pattern. However, consider using
RequestMethod.OPTIONS.name()instead of the string literal for better maintainability and consistency with the enum used in ApitallyUtils.- if (!client.isEnabled() || request.getMethod().equals("OPTIONS")) { + if (!client.isEnabled() || request.getMethod().equals(RequestMethod.OPTIONS.name())) {You would need to add the import:
import org.springframework.web.bind.annotation.RequestMethod;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/io/apitally/spring/ApitallyFilter.java(1 hunks)src/main/java/io/apitally/spring/ApitallyUtils.java(2 hunks)
🔇 Additional comments (4)
src/main/java/io/apitally/spring/ApitallyUtils.java (4)
9-9: Necessary import addition.The import for
RequestMethodis correctly added to support the filtering logic.
23-23: Good implementation for excluding OPTIONS and HEAD methods.The filter correctly excludes OPTIONS and HEAD methods from path generation, which is appropriate since:
- OPTIONS requests are typically CORS preflight requests
- HEAD requests are usually not part of core API functionality requiring monitoring
- This reduces noise in API analytics and path data
The implementation using
RequestMethodenum comparison is clean and type-safe.
9-9: Import added appropriately.The
RequestMethodimport is necessary for the filtering logic and is correctly placed.
23-23: Excellent filtering implementation.The filter correctly excludes OPTIONS and HEAD methods from path generation using enum comparison, which is more robust than string comparison. This appropriately prevents metadata requests from being included in the API path tracking.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
============================================
- Coverage 78.17% 77.72% -0.46%
+ Complexity 314 313 -1
============================================
Files 31 31
Lines 1054 1055 +1
Branches 133 133
============================================
- Hits 824 820 -4
- Misses 157 159 +2
- Partials 73 76 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit