dolphinium opened a new pull request, #90:
URL: https://github.com/apache/solr-mcp/pull/90

   > Split out from #89 at maintainer's request — this PR contains only the 
Content-Type tolerance fix.
   
   ## Summary
   
   Widens `JsonResponseParser#getContentTypes()` to advertise both 
`application/json` and `text/plain`, so SolrJ stops rejecting otherwise-valid 
JSON responses that are served with `Content-Type: text/plain`.
   
   ## Motivation
   
   Some Solr request handlers (notably `/admin/ping` and a number of 
standalone-mode paths) return JSON-encoded bodies with `Content-Type: 
text/plain`. SolrJ validates the response Content-Type against the set 
advertised by the configured `ResponseParser` and fails with:
   
   ```
   Expected mime type in [application/json] but got text/plain
   ```
   
   …even though the payload is a valid Solr JSON response. This surfaces to MCP 
clients through tools like `check-health` and `search` as errors, despite the 
underlying query succeeding.
   
   Observed end-to-end against a real standalone Solr 9.x instance: 
`check-health` and `search` both return the error above pre-fix, and return 
clean results post-fix.
   
   ## Changes
   
   - `JsonResponseParser#getContentTypes`: advertise `application/json` **and** 
`text/plain`.
   - No behavioural change for handlers that already return `application/json`.
   
   ## Tests
   
   - `JsonResponseParserContentTypesTest` (new): pins the advertised 
Content-Type set.
   - `./gradlew build` passes locally (Spotless + NullAway + full unit suite).
   
   ## Test plan
   
   - [x] `./gradlew spotlessCheck`
   - [x] `./gradlew build` (unit tests)
   - [x] Manual end-to-end against a standalone Solr 9.x — `check-health` and 
`search` now succeed on handlers that previously returned `text/plain`.
   
   ## Notes
   
   - No new runtime dependencies.
   - Behaviour is strictly additive (accepting one more Content-Type).
   - Signed off under DCO; commit follows Conventional Commits per 
`CONTRIBUTING.md`.
   
   Companion PR for the Basic Auth feature: #89
   
   Co-authored-by: Claude <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to