coffeinik
coffeinik

Reputation: 81

Play framework WS set cookie

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

Answers (2)

mob
mob

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

Leonya
Leonya

Reputation: 535

WS.url(theurl).withHeaders("Cookie" -> "cookiename=cookieval; name2=val2")

Upvotes: 12

Related Questions