[ 
https://issues.apache.org/jira/browse/SOLR-12858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121802#comment-18121802
 ] 

Nick Shanin commented on SOLR-12858:
------------------------------------

🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)*

I picked this up intending to fix it, but the reported failure does not 
reproduce on current main: `embeddedSolrServer.query(new SolrQuery("*:*"), 
SolrRequest.METHOD.POST)` returns results instead of throwing "Bad contentType 
for search handler :application/javabin". The request writers no longer 
serialize query params into a body (JavaBinRequestWriter.write() only marshals 
UpdateRequest), so a POST query never gets a javabin content stream attached 
and RequestUtil.processParams() never sees a non-JSON content type. I wrote a 
regression test for the exact reported repro; it passes identically with and 
without my attempted guard, confirming the guard is a no-op, so I dropped the 
branch instead of opening a PR. I would suggest closing this out: the 7.x bug 
was fixed incidentally by later refactoring.

> EmbeddedSolrServer POST method has contentType issue
> ----------------------------------------------------
>
>                 Key: SOLR-12858
>                 URL: https://issues.apache.org/jira/browse/SOLR-12858
>             Project: Solr
>          Issue Type: Bug
>    Affects Versions: 7.4, 7.5
>            Reporter: Phillip Klinefelter
>            Priority: Major
>
> EmbeddedSolrServer will fail with the following exception when using a POST 
> method.
> {{org.apache.solr.common.SolrException: Bad contentType for search handler 
> :application/javabin request=\{q=*:*}}}{{    at 
> org.apache.solr.request.json.RequestUtil.processParams(RequestUtil.java:73)}}
> {{     at 
> org.apache.solr.util.SolrPluginUtils.setDefaults(SolrPluginUtils.java:167)}}
> {{     at 
> org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:196)}}
> {{     at org.apache.solr.core.SolrCore.execute(SolrCore.java:2539)}}
> {{     at 
> org.apache.solr.client.solrj.embedded.EmbeddedSolrServer.request(EmbeddedSolrServer.java:191)}}
> {{     at 
> org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:194)}}
> {{     at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:974)}}
> {{     at org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:990)}}
> A POST method can be added to TestEmbeddedSolrServerConstructors to reproduce 
> or do the following.
> {{embeddedSolrServer.query(new SolrQuery("*:*"), SolrRequest.METHOD.POST);}}
> This worked before Solr 7.4.  The issue appears to have been caused by 
> changes made in SOLR-12142 based on debugging and a discussion I had with 
> [~dsmiley].
> CC [~noble.paul]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to