This is technically a duplicate to this thread:
However, the code in there doesn't seem to work for me. I see in the changelogs for dispatch that handing has changed subtley, but for the life of me I cannot get this to work. I think this is a problem with me understanding scala and not a library problem.
import dispatch._, Defaults._
// import com.ning.http.client.Response
object HTTPDownloader extends App {
val goog: Req = host("google.com").secure
val res = Http(goog.HEAD OK as.Response).option()
print(res)
Thread.sleep(5000)
}
I'm trying to get headers from a website that I know is up so that I can check the content length, but the error I get when I compile this snippet is
[error] ... Download.scala:14: type mismatch;
[error] found : dispatch.as.Response.type
[error] required: com.ning.http.client.Response => ?
[error] val res = Http(goog.HEAD OK as.Response).option()
I try to import client.Response instead with import com.ning.http.client.{ Response => nonconflictingname }, but then it says "object com.ning.http.client.Response is not a value." I have no idea what that means.