Hello, I am trying to make REST API call with akka http client. Below is “log in” request:
Http().singleRequest(HttpRequest(...)).flatMap { resp =>
println("headers = " + resp.headers)
println("cookie = " + resp.header[`Set-Cookie`])
...
}
This is what I see in console:
headers = List(set-cookie: myCookie=blahblah; Expires=Fri, 24 Jan 2020 13:42:55 GMT; Domain=; Path=/, Server: akka-http/10.1.6, Date: Thu, 24 Jan 2019 13:42:55 GMT)
cookie = None
In debugger I see that ‘headers’ collection contains RawHeader with ‘set-cookie’.
In network sniffer I see:
Set-Cookie: myCookie=blahblah; Expires=Fri, 24 Jan 2020 13:42:55 GMT; Domain=; Path=/
Also there is a warning from akka:
Illegal header: Illegal 'set-cookie' header: Invalid input ';', expected OWS or domain-value (line 1, column 145): myToken=blahblah; Expires=Fri, 24 Jan 2020 13:42:55 GMT; Domain=; Path=/
The cookie is set at server-side by ‘setCookie’ routing directive (under the same version of Java, Scala, Akka etc, at the same Linux machine, localhost), browsers understand it. I use Scala 2.12.8, akka 2.5.19, akka http 10.1.6, Java 8
What is wrong here?