1

I have a request generated by putting map of parameters

  val reqUrl = url("http://example.com")
  val req = reqUrl << Map("key" -> "value")

I need to get request body in order to calculate it's hash. I'm trying this way

  val data = req.toRequest.getStringData

  println(data)

but it results null.

Poni Poni
  • 113
  • 2
  • 5

1 Answers1

3

The request you currently defined is a GET request which normally has no body. So null is the expected body value.

You could try using a POST as described here : http://dispatch.databinder.net/HTTP+methods+and+parameters.html.

val reqUrl = url("http://example.com")
val postReq = reqUrl.POST
val req = postReq << Map("key" -> "value")
req.toRequest.getStringData
bbarker
  • 11,636
  • 9
  • 38
  • 62
Andreas Neumann
  • 10,734
  • 1
  • 32
  • 52