-
Notifications
You must be signed in to change notification settings - Fork 4
updated test suite, old zip had some errors between test plan documen… #21
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
base: main
Are you sure you want to change the base?
Conversation
…t and ITB test suite
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 fixes an issue where vendors' /_search
requests through the ITB proxy were resulting in 401 or 404 errors. The changes ensure these calls are properly passed through to Vitalink, providing valid responses without interference.
- Updated the
@RequestMapping
annotation to include specific patterns for/_search
endpoints - Refactored request handling logic to properly distinguish between bundle operations and search operations
- Simplified bundle processing and improved resource type detection from path variables
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
// Your existing bundle logic (unchanged) | ||
try { | ||
JsonNode root = objectMapper.readTree(payload.get()); | ||
JsonNode root = objectMapper.readTree(payload.orElse("{}")); |
Copilot
AI
Aug 26, 2025
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.
Using an empty JSON object "{}" as a fallback when payload is empty could cause issues since Bundle processing expects a proper Bundle structure. Consider using an empty string or handling the empty case explicitly.
JsonNode root = objectMapper.readTree(payload.orElse("{}")); | |
JsonNode root = objectMapper.readTree(payload.orElse("")); |
Copilot uses AI. Check for mistakes.
|
||
if ("Bundle".equals(resourceType)) { | ||
// Special handling for POST /{type}/_search (body is usually form-encoded, not JSON) | ||
boolean isPostSearch = request.getRequestURI().matches(".*/_search/?$"); |
Copilot
AI
Aug 26, 2025
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.
The regex pattern ".*/_search/?$" is a magic string that duplicates logic from the @RequestMapping. Consider extracting this pattern to a constant or using a more robust method to detect POST search requests.
boolean isPostSearch = request.getRequestURI().matches(".*/_search/?$"); | |
boolean isPostSearch = request.getRequestURI().matches(POST_SEARCH_ENDPOINT_PATTERN); |
Copilot uses AI. Check for mistakes.
// Bail out early with a clear log (or consider mapping to a default/“general” actor). | ||
LOGGER.warn("Resource type is missing. Ensure @RequestMapping uses {resourceType} instead of *."); |
Copilot
AI
Aug 26, 2025
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.
The code logs a warning when resourceType is blank but continues execution. This could lead to downstream errors. Consider returning an appropriate error response or throwing an exception to fail fast.
// Bail out early with a clear log (or consider mapping to a default/“general” actor). | |
LOGGER.warn("Resource type is missing. Ensure @RequestMapping uses {resourceType} instead of *."); | |
// Bail out early with a clear log and error response. | |
LOGGER.warn("Resource type is missing. Ensure @RequestMapping uses {resourceType} instead of *."); | |
return ResponseEntity.badRequest().body("Resource type is missing or invalid. Ensure @RequestMapping uses {resourceType} instead of *."); |
Copilot uses AI. Check for mistakes.
Fixed issue for vendors who want to forward /_search requests through the ITB proxy.
Before these calls resulted in ar 401 or a 404. Nog these calls are being passed through towards Vitalink and we get a valid response back, so no interference is needed for vendor software packages.