3

How can I find out whether the right header has been passed to my request or not.

This is my header

<http:headers ><![CDATA[#[output application/java
---
{
    Authorization : vars.authorizationToken
}]]]></http:headers>

My request is failing again and again as right token is not passed.

UPDATE:

After enabling wire-logging.I observed that my Header's case was not preserved. I enabled the case and it started working.

HMT
  • 2,093
  • 1
  • 19
  • 51

1 Answers1

3

You can use wire logging to see the actual HTTP message being sent. See this guide for details.

afelisatti
  • 2,770
  • 1
  • 13
  • 21
  • I think it is passing my token with double quotes : Authorization: "token" instead of passing it as Authorization: token . How do I remove double quotes ?? – HMT Apr 13 '20 at 13:22
  • You'd have to check how that variable is being set, perhaps the quotes are there already. – afelisatti Apr 13 '20 at 13:25
  • The variable is set when token is received by HTTP Listener. Now, how do I remove double quotes ? – HMT Apr 13 '20 at 14:17
  • That's a different question than the original one. You should ask a new one about the quotes. – aled Apr 13 '20 at 14:24
  • @afelisatti So in the logs, I found that the Authorization in my header was converted to authorization. I think this is the reason behind the request failure – HMT Apr 13 '20 at 15:16
  • That's expected behavior. – aled Apr 13 '20 at 17:16
  • 1
    HTTP headers are case insensitive, it shouldn't matter what case they are in. If that is indeed the problem then you are dealing with a non RFC compliant server. I suggest trying with a different client , like postman or curl, sending the header in lower case to validate whether that is indeed the issue. For the quotes thing, it may be the format you are storing that variable in when extracting it from wherever it's coming, I'd make sure it's `application/java`. – afelisatti Apr 13 '20 at 17:38
  • @afelisatti You were right , I was dealing with a non RFC compliant server. Thanks for your inputs – HMT Apr 15 '20 at 17:27
  • If I recall correctly there's a "preserveHeadersCase" option in the HTTP components to deal with kind of servers. – afelisatti Apr 17 '20 at 11:54