In my test code, I need to send request using jersy client 2.7 in java. I need to set multiple headers of the web request. e.g.
Header1 12
Header2 abc
In my current working implementation the request is getting formed as mentioned below. Wherein I am only setting the Authorization token in header using function
public void setAuthorizationToken(String authorizationToken) {
this.token = authorizationToken;
}
response = webResource.request(MediaType.APPLICATION_JSON) .header("Authorization", this.token).post(Entity.entity(jsonString, mediaType));
I checked that there is a method headers (MultiValuedMap < String,Object > headers) to set multiple header KV pairs.
But did not get how to use it.
I have to set the header key value pair from some other function (say setHeader()) to add more headers in this request as mentioned above.
Can someone please let me know how can I do it?