I am performing a GET call using CRISP passing two parameters in the header, but they are ignored.
Debugging the code I have seen the following in SimpleJacksonRestTemplateResourceResolver, line 77:
if (HttpMethod.POST.equals(httpMethod)) {
result = restTemplate.postForEntity(this.getBaseResourceURI(baseAbsPath), requestObject, String.class, pathVariables);
} else {
result = restTemplate.getForEntity(this.getBaseResourceURI(baseAbsPath), String.class, pathVariables);
}
The “requestObject”, the object containing the headers set using ExchangeHintBuilder as written in the documentation here https://documentation.bloomreach.com/library/concepts/crisp-api/getting-started.html is only passed if the call is in POST, while it is ignored in all the other cases.
I have composed the request like the following:
Use #resolveBinary(...) [1] instead and parse the Binary output to JSON by yourself.
As Spring RestTemplate doesn’t support headers in get*() methods for the reasons based on http specification, CRISP doesn’t support it either by default. But I think #resolveBinary(...) passes all including headers and body if available. That will do the workaround.
Thanks for updates, Flavio!
I’m thinking that we could improve a small thing but useful: we can perhaps add #resolveBinaryAsResource(...) to return a parsed Resource object instead of Binary, assuming the caller knows the return must be either JSON or XML.
Then it might be more useful in many cases. How does it sound?