HTTPS POST with Scala and Submission

I am trying to make an HTTPS message with scala and the Dispatch library. I cannot find where to mark my connection as https, not http. Here is the code that I still have

println("Running Test")
val http = new Http
val req = :/("www.example.com" , 443) / "full/path.asp"
var response: NodeSeq = Text("")
http(req << "username=x&password=y" <> {response = _ } )
response
println("Done Running Test")

EDIT

So, trying to figure this out, I made sure that the http line looked like this:

http(req.secure << "username=x&password=y" <> {response = _ } )

Also in this particular instance, I needed to do a POST as application / x-www-form-urlencoded, which required the line to look like

http(req.secure << ("username=x&password=y","application/x-www-form-urlencoded") <> {response = _ } )

Now it will replace 40 lines of C ++ + Boost + Asio code.

+5
source share
2 answers

So, trying to figure this out, I made sure that the http line looked like this:

http(req.secure << "username=x&password=y" <> {response = _ } )    

Also in this particular instance, I needed to do a POST as application / x-www-form-urlencoded, which required the line to look like

http(req.secure << ("username=x&password=y","application/x-www-form-urlencoded") <> {response = _ } 
+3
source

You can apply "safe" to: / factory:

:/("host").secure
+1
source

All Articles