# CRISP - cannot send headers in GET calls

**URL:** <https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [April 9, 2019, 8:28am UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958 "2019-04-09T08:28:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flavio\_Ricci](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/flavio_ricci/32/256_2.png) [@Flavio\_Ricci](https://community.bloomreach.com/u/Flavio_Ricci)\
**Post date:** [April 9, 2019, 8:28am UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/1 "2019-04-09T08:28:04Z")

</div>

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](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:

ResourceServiceBroker broker = CrispHstServices.getDefaultResourceServiceBroker();  
ExchangeHint headers = ExchangeHintBuilder.create()  
.methodName(“GET”)  
.requestHeader(“email”, "test-email@gmail.com")  
.requestHeader(“password”, “04ba23a976b4da6ae873c9830f73aace6c3162cb”)  
.build();

Resource loginHash = broker.findResources(“crisp-resource”, “path”, headers);

Is there a workaround to do it or can it be fixed?

Thanks

---

<div class="post-metadata">

**Author:** ![giacomolm](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/giacomolm/32/1733_2.png) [@giacomolm](https://community.bloomreach.com/u/giacomolm)\
**Post date:** [April 9, 2019, 9:42am UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/2 "2019-04-09T09:42:13Z")

</div>

Hi,  
using headers in GET requests is not following the standard.

But you can write your custom ResourceResolver and pass headers while sending the request [1].

HTH,  
Giacomo

[1] [https://documentation.bloomreach.com/library/concepts/crisp-api/configuring-crisp-addon.html](https://documentation.bloomreach.com/library/concepts/crisp-api/configuring-crisp-addon.html)

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [April 9, 2019, 12:16pm UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/3 "2019-04-09T12:16:34Z")

</div>

> [@Flavio\_Ricci](#):
>
> ResourceServiceBroker broker = CrispHstServices.getDefaultResourceServiceBroker();  
> ExchangeHint headers = ExchangeHintBuilder.create()  
> .methodName(“GET”)  
> .requestHeader(“email”, “[test-email@gmail.com](mailto:test-email@gmail.com)”)  
> .requestHeader(“password”, “04ba23a976b4da6ae873c9830f73aace6c3162cb”)  
> .build();
> 
> Resource loginHash = broker.findResources(“crisp-resource”, “path”, headers);
> 
> Is there a workaround to do it or can it be fixed?

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.

Regards,

Woonsan

[1] [Getting Started - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS](https://documentation.bloomreach.com/library/concepts/crisp-api/getting-started.html)

---

<div class="post-metadata">

**Author:** ![Flavio\_Ricci](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/flavio_ricci/32/256_2.png) [@Flavio\_Ricci](https://community.bloomreach.com/u/Flavio_Ricci)\
**Post date:** [April 9, 2019, 4:05pm UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/4 "2019-04-09T16:05:22Z")

</div>

Thank you Woonsan, I confirm that I managed to perform that call

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [April 9, 2019, 4:28pm UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/5 "2019-04-09T16:28:23Z")

</div>

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?

Woonsan

---

<div class="post-metadata">

**Author:** ![Flavio\_Ricci](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/flavio_ricci/32/256_2.png) [@Flavio\_Ricci](https://community.bloomreach.com/u/Flavio_Ricci)\
**Post date:** [April 10, 2019, 9:43am UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/6 "2019-04-10T09:43:04Z")

</div>

Hi Woonsan,  
yes I agree it would be great and coherent with the other methods return type  
Thanks!

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [April 10, 2019, 12:49pm UTC](https://community.bloomreach.com/t/crisp-cannot-send-headers-in-get-calls/958/7 "2019-04-10T12:49:17Z")

</div>

All right. I’ve filed a ticket:

- [https://issues.onehippo.com/browse/CRISP-79](https://issues.onehippo.com/browse/CRISP-79)

Thanks,

Woonsan
