v5.12.0
losizm
released this
13 Apr 04:17
What's New?
Add Single Cookie
You can add a single cookie to a request or response without replacing all existing cookies.
import scamper.ImplicitConverters._
import scamper.RequestMethods._
import scamper.cookies._
val c1 = PlainCookie("WMF-Last-Access", "13-Apr-2019")
val c2 = PlainCookie("WMF-Last-Access-Global", "13-Apr-2019")
val c3 = PlainCookie("GeoIP", "US:FL:Tampa:33.44:-55.66:v4")
val req = GET("https://en.wikipedia.org/wiki/Main_page")
.withCookies(c1, c2)
.withCookie(c3) // Add c3 and keep c1, c2
Create Secure Server
You can create a secure server using the processor construct.
import java.io.File
import scamper.ImplicitConverters.stringToEntity
import scamper.ResponseStatuses.Ok
import scamper.server.HttpServer
val port = 8089
val key = new File("/path/to/private.key")
val cert = new File("/path/to/public.cert")
val server = HttpServer.create(port, key, cert) { req =>
Ok("Hello, world")
}