Skip to content

Commit

Permalink
Generate 'setQueryParams' method
Browse files Browse the repository at this point in the history
Ensures v2 POST query-params aren't put in a 'form' body.
  • Loading branch information
gerlowskija committed Jan 20, 2025
1 parent 0ed3367 commit 5f77816
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,6 @@ private void distribute(FileInfo info) {
nodeToFetchFrom = "*";
}
try {
// TODO NOCOMMIT This request succeeds but quietly doesn't pass the 'getFrom' parameter
// due to logic in HSC that whitelists the query params sent through on POST and PUT
// requests. I've never really understood this logic well, does it still need to exist?
final var pullFileRequest = new FileStoreApi.ExecuteFileStoreCommand(info.path);
pullFileRequest.setGetFrom(nodeToFetchFrom);
final var client = coreContainer.getSolrClientCache().getHttpSolrClient(baseUrl);
Expand Down
11 changes: 11 additions & 0 deletions solr/solrj/src/resources/java-template/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ import java.io.OutputStream;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;


import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.response.SimpleSolrResponse;
Expand Down Expand Up @@ -239,6 +241,15 @@ public class {{classname}} {
return params;
}

@Override
public Set<String> getQueryParams() {
final var queryParams = new HashSet<String>();
{{#queryParams}}
queryParams.add("{{baseName}}");
{{/queryParams}}
return queryParams;
}

@Override
protected {{operationIdCamelCase}}Response createResponse(SolrClient client) {
return new {{operationIdCamelCase}}Response();
Expand Down

0 comments on commit 5f77816

Please sign in to comment.