epugh opened a new pull request, #4080:
URL: https://github.com/apache/solr/pull/4080

   https://issues.apache.org/jira/browse/SOLR-18085
   
   # Description
   
   The use of `wt=standard` is odd..   It really means return `json` formatted 
code.   I dug around some more and we have werid complex logic around this 
parameter.   Digging furthur, I think most of the complexity is not needed.
   
   The one thing that I DID change is that before if you did "wt=fake" then you 
would get JSON back in many places.   And in the V2 api's if you did "wt=fake" 
you would get a 400 back with an error.   I think the right think in either of 
those cases is a 500 server error.   
   
   THis is what my last commit did:
   
   Summary
   
   I've updated the code so that when an invalid/unknown `wt` parameter is 
provided, Solr returns a **500 Server Error** instead of silently falling back 
or returning a null writer.
   
   ### Changes Made to default behavior:
   
   1. **`SolrQueryRequest.java`** (lines 207-222):
      - Added validation that throws a `SolrException` with `SERVER_ERROR` 
(500) when the response writer is not found for the given `wt` parameter
      - The error message clearly states: "Unknown response writer type: {wt}"
   
   2. **`V2ApiIntegrationTest.java`**:
      - Split the original `testWTParam` test into two tests:
        - `testInvalidWTParamReturnsError` - verifies that `wt=bleh` returns a 
500 error with the appropriate message
        - `testWTParam` - verifies that when no wt is specified, JSON is used 
by default
   
   3. **`TestPrometheusResponseWriter.java`**:
      - Updated the comment in `testUnsupportedMetricsFormat` to clarify that 
unknown wt parameters return a 500 error
      - The test already asserted `assertEquals(500, 
res.get("responseStatus"))` which now passes
   
   # Solution
   
   Mostly refactoring, except for the big change in <INSERT OCMMIT>
   
   # Tests
   
   Re ran test
   


-- 
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