I'm trying to retrieve a cookie from Akka HttpResponse
val httpRequest = HttpRequest(method=HttpMethods.POST, uri = uri, entity=params) val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = uri))
responseFuture2.flatMap { response => println(response.entity) response.headers.collect { case hc => println(hc) } }
However I cannot find the cookie value in either response entity or response headers. I believe that the cookie jar should have been supported already in akka. https://github.com/spray/spray/pull/311
Does anyone has idea how can I retrieve the cookie by utilizing akka? Thanks in ad!
Here's how I've done it in python.
cookie_jar = cookielib.CookieJar() non_redirecting_opener = urllib2.build_opener(NoRedirectionProcessor, urllib2.HTTPCookieProcessor(cookie_jar)) response = non_redirecting_opener.open(request) cookies = {cookie.name: cookie for cookie in cookie_jar}