I wanted to use Diffy for my API testing but found that it does not allow customization of headers while sending requests. Our Apis need access tokens which are different in different servers that are passed as HTTP Headers.
I started exploring the Diffy code and tried to resolve this issue (for me) myself.
Understanding the flow/code is a bit difficult for me as I have no experience in scala. However I understood the code a little and tried to add a line of code at [HttpDifferenceProxy.scala] (https://github.com/twitter/diffy/blob/master/src/main/scala/com/twitter/diffy/proxy/HttpDifferenceProxy.scala)
The Diffy tool executes a Http Request asynchronously after checking whether it is allowed to do so. I added my line of code here before this check to add a header.
object SimpleHttpDifferenceProxy {
lazy val httpSideEffectsFilter =
Filter.mk[HttpRequest, HttpResponse, HttpRequest, HttpResponse] { (req, svc) =>
req.headers().add("Authorization1", "123") //My code here
val hasSideEffects =
Set(Method.Post, Method.Put, Method.Delete).contains(Request(req).method)
if (hasSideEffects)
DifferenceProxy.NoResponseExceptionFuture else svc(req)
} }
Okay I am facing two problems.
- The header is not getting added
- Any suggestion for a good Scala IDE -- I am using ScalaIDE built on top of Eclipse but the debugging is nowhere close to debugging capabilities of Eclipse in java.
What am I doing wrong here?
Thanks, Sukalpo.