SOLR-2020: fix another bug with param encoding with multipart request

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1330803 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sami Siren 2012-04-26 12:17:58 +00:00
parent 021986f9f2
commit fcfa443d3c
2 changed files with 12 additions and 1 deletions

View File

@ -294,7 +294,7 @@ public class HttpSolrServer extends SolrServer {
} }
if (parts.size() > 0) { if (parts.size() > 0) {
MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); MultipartEntity entity = new MultipartEntity(HttpMultipartMode.STRICT);
for(FormBodyPart p: parts) { for(FormBodyPart p: parts) {
entity.addPart(p); entity.addPart(p);
} }

View File

@ -613,6 +613,17 @@ abstract public class SolrExampleTests extends SolrJettyTestBase
assertNotNull("Couldn't upload xml files", result); assertNotNull("Couldn't upload xml files", result);
rsp = server.query( new SolrQuery( "*:*") ); rsp = server.query( new SolrQuery( "*:*") );
Assert.assertEquals( 5 , rsp.getResults().getNumFound() ); Assert.assertEquals( 5 , rsp.getResults().getNumFound() );
//params encoding, multipart
up = new ContentStreamUpdateRequest("/debug/dump");
up.addFile(getFile("solrj/docs1.xml")); // 2
up.addFile(getFile("solrj/docs2.xml")); // 3
up.setParam("a", "\u1234");
result = server.request(up);
System.out.println(result);
Assert.assertEquals("\u1234",
((NamedList)((NamedList) result.get("responseHeader")).get("params")).get("a"));
} }