Open mohan-krishnan opened 11 years ago
I've tested it again and found that you don't get the header value because the header() method isn't called. The reason is the name of method header(), I don't know what it has special meaning but when I changed the name, it works. You can change and check again:
In RequestCustomizer class change the method header to headers
RequestCustomizer headers(String name, String value) { headers[name] = value return this }
And then using with new name
RestBuilder rest = new RestBuilder(connectTimeout:5000, readTimeout:20000);
rest.get("
This issue is because you're using this from a controller, so instead of calling the header method of the RestBuilder it calls the header method of the controller. The workaround is to do:
delegate.header("foo", "bar")
or
headers["foo"] = "bar"
I am using the latest grails (2.1.2) with rest-client-builder plugin version 1.0.3. I am trying to pass in a custom request header value (say SEC_USER) to the target server which pre-authenticates a request with this request header value. I am using the following code to pass the value in but I dont get the header value in the receiving end.
Looking at RequestCustomizer in the RestBuilder class the header() method should add a named header to the HttpHeaders field as it calls headers[name] = value
Could this be an issue in the RestTemplate class (method exchange(...)) which this plugin uses internally?