Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR merges the develop branch into main, adding rate limiting functionality to the application along with supporting infrastructure and configuration changes.
- Added API throttling filter with configurable rate limiting using Redis-backed bucket4j
- Added new authentication endpoint for token validation
- Added Neo4j database initialization for local development environment
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/com/sillim/recordit/config/filter/ApiThrottlingFilter.java | Core rate limiting filter implementation using bucket4j |
| src/main/java/com/sillim/recordit/config/ratelimiter/RateLimiterConfig.java | Configuration for rate limiter with Redis backend |
| src/main/java/com/sillim/recordit/config/filter/LimitApi.java | Utility class for defining rate-limited API patterns |
| src/main/java/com/sillim/recordit/config/cache/RedisConfig.java | Added RedisClient bean for rate limiter |
| src/main/java/com/sillim/recordit/member/controller/LoginController.java | Added token validation endpoint |
| src/main/java/com/sillim/recordit/global/exception/ErrorCode.java | Added error code for rate limiting |
| src/main/java/com/sillim/recordit/config/neo4j/LocalNeo4jInitializer.java | Database initialization for local environment |
| src/test/java/com/sillim/recordit/config/filter/ApiThrottlingFilterTest.java | Unit tests for rate limiting filter |
| src/test/java/com/sillim/recordit/support/restdocs/RestDocsTest.java | Added mock bean for filter testing |
| application-*.yml | Configuration properties for rate limiting |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
src/main/java/com/sillim/recordit/config/neo4j/LocalNeo4jInitializer.java
Outdated
Show resolved
Hide resolved
| long waitForRefill = probe.getNanosToWaitForRefill() / 1_000_000_000; | ||
|
|
||
| HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| httpResponse.setContentType("text/plain; charset=UTF-8"); |
There was a problem hiding this comment.
Content type is set to 'text/plain' but the response body contains JSON. This should be 'application/json; charset=UTF-8' to match the actual response format.
| httpResponse.setContentType("text/plain; charset=UTF-8"); | |
| httpResponse.setContentType("application/json; charset=UTF-8"); |
| ResponseEntity.status(TOO_MANY_REQUEST) | ||
| .body( | ||
| ErrorResponse.from( | ||
| ErrorCode.TOO_MANY_REQUEST, | ||
| waitForRefill + "초 뒤에 다시 시도해주세요")))); |
There was a problem hiding this comment.
Writing a ResponseEntity as JSON string will include HTTP headers and metadata in the response body. Extract only the body using .getBody() or create the ErrorResponse directly without wrapping it in ResponseEntity.
| ResponseEntity.status(TOO_MANY_REQUEST) | |
| .body( | |
| ErrorResponse.from( | |
| ErrorCode.TOO_MANY_REQUEST, | |
| waitForRefill + "초 뒤에 다시 시도해주세요")))); | |
| ErrorResponse.from( | |
| ErrorCode.TOO_MANY_REQUEST, | |
| waitForRefill + "초 뒤에 다시 시도해주세요"))); |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.