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

   'wt' takes precedence if specified for now, if not provided Solr (through 
our use of Jersey) will pick a response format in keeping with the specified 
'Accept' header.
   
   JSON responses remains the "default" if neither 'wt' nor an "Accept" header 
are specified.
   
   Still needed:
     - tests
     - CHANGES.txt entry
   
   https://issues.apache.org/jira/browse/SOLR-10998
   
   
   
   # Description
   
   The HTTP spec defines an ["Accept" 
header](https://httpwg.org/specs/rfc7231.html#header.accept) that users can 
provide to specify the response format (or formats, plural) that they're 
willing to "accept" in a response.  This is part of the HTTP specs support for 
"content negotiation" more generally.
   
   Solr today doesn't support this, and opts to have users specify their 
response format in a "wt" (i.e. "writer type") query-parameter.  We should obey 
"Accept" headers, when they are provided.
    
   # Solution
   
   This PR modifies Solr to obey "Accept" headers on v2 API requests, unless an 
overriding "wt" parameter is also provided.  Jersey (which is used for v2 
requests) actually obeys the "Accept" header out of the box, but a bug in our 
`MediaTypeOverridingFilter` (which implements the 'wt' override) was causing 
the value of "Accept" to be ignored altogether.
   
   With this change, the order of precedence for v2 APIs is: `wt` parameter, 
then `Accept` header, and lastly "JSON" is used as a fallback/default.
   
   # Tests
   
   TBD - still need tests here to ensure that v2 APIs obey common 'wt' and 
Accept header values.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my 
code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [x] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended, not available for 
branches on forks living under an organisation)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


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