Reputation: 113
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
.
Upvotes: 1
Views: 547
Reputation: 10884
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
Upvotes: 3