SignatureCalculator API

23 views
Skip to first unread message

Scala_Amateur

unread,
Jan 5, 2017, 2:45:48 PM1/5/17
to scala-user
Hi All,

Has anyone used SignatureCalculator API to explain to me how to effectively use it to create a token (once) and cache it to be used for testing? I have looked at the interface SignatureCalculator but I am not able to understand how to implement it.

This is what I have right now:
lass mySignatureCalculator extends SignatureCalculator {

// Default Headers
val defaultHeaders = Map("Content-Type" -> "application/json", "Authorization" -> "Basic 123345")

// Http Client Config
val httpConf: HttpProtocolBuilder = http
.baseURL("https://website.com") // Here is the root for all relative URLs
.headers(defaultHeaders)
.acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // Here are the common headers
.acceptEncodingHeader("gzip, deflate")
.acceptLanguageHeader("en-US,en;q=0.5")
.userAgentHeader("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:16.0) Gecko/20100101 Firefox/16.0")

var called = false

override def calculateAndAddSignature(request: Request,
requestBuilder: RequestBuilderBase[_]): Unit = {

called = true
}
}

Thank you very much.
Reply all
Reply to author
Forward
0 new messages