Using mappedRequestHeaders in Spring XD

252 views Asked by At

I am trying to simulate the following curl statement

curl -k -H "username: Your API Username" -H "password: Your API Password" https://infoconnect1.highwayinfo.govt.nz/ic/jbi/TrafficCameras/REST/FeedService/

How do I use mappedRequestHeaders to inject username and password into http-client stream?

1

There are 1 answers

1
ebottard On

I think what you're trying to do can be achieved by enriching the message flow with the two headers you want and then using mappedRequestHeaders to specify that those should be propagated.

Something like this:

whatever | modules | transform --script=enrich.groovy | http-client --mappedRequestHeaders=username,password

where enrich.groovy adds username and password as headers in the Spring Integration message.

This does call out for an easy way to pass http headers though, maybe as an option to the module. I created https://jira.spring.io/browse/XD-2372 to track this, if you're interested