Skip to content

Commit

Permalink
Switch to getQueryString - removes length change exception
Browse files Browse the repository at this point in the history
  • Loading branch information
andywebb1975 committed May 5, 2024
1 parent 545e668 commit 5e3d3ef
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,9 @@ private PreparedRequest preparePutOrPost(
queryParams.add(calculateQueryParams(solrRequest.getQueryParams(), requestParams));
// bP receives any remaining params from original set
// with this version the params are not fully encoded - we get raw Unicode chars, curly braces etc - and the body content length changes, presumably due to re-encoding
String bodyQueryString = requestParams.toString();
// String bodyQueryString = requestParams.toString();
// with this version the params are fully encoded - note the toQueryString() method adds an unwanted leading question mark
String bodyQueryString = requestParams.toQueryString().substring(1);
bodyPublisher = HttpRequest.BodyPublishers.ofString(bodyQueryString);
// this isn't intended to be merged - but it shows the content length change noted above
if (bodyQueryString.length() != bodyPublisher.contentLength()) throw new URISyntaxException("inconsistent content length", bodyQueryString + " - " + bodyQueryString.length() + " -> " + bodyPublisher.contentLength());
Expand Down

0 comments on commit 5e3d3ef

Please sign in to comment.