Reputation: 81
How can I set cookie in WS request?
val request = WS.url("http://testurl.com/test.pdf")
Is it possible?
I'm using Play version 2.1.1
Upvotes: 6
Views: 4547
Reputation: 587
You can also add domain and path to the cookie in the same manner
WS.url("http://url.com").withHeaders("Cookie" -> "cookieName=value; domain=url.com; path=/")
Upvotes: 0
Reputation: 535
WS.url(theurl).withHeaders("Cookie" -> "cookiename=cookieval; name2=val2")
Upvotes: 12