Duc
Duc

Reputation: 501

How to send cookie with http request in Scala without using any other library?

I have a JSESSIONID that I need to set on my http request. I'm using play framework. Tried: WS.url(XML_MNP_URL).withHeaders("Cookie" -> headerSessionId) but it doesn't work. Please help, thanks

Upvotes: 1

Views: 1307

Answers (1)

frostmatthew
frostmatthew

Reputation: 3298

To add cookies to a request using withHeaders use COOKIE, not "Cookie" when setting the headers:

WS.url(XML_MNP_URL).withHeaders(COOKIE -> "foo=bar")

The request will now include Cookie: foo=bar as a header

Upvotes: 1

Related Questions