How to http post with an empty body request using WS API in Playframework 2 / Scala?
http-post, playframework-2.0, rest, scala, web-services
Solution
Since `post` awaits a value that implements the `Writeable` and `ContentTypeOf` type classes, you can use the `Results.EmptyContent` from `play.api.mvc`. (See API)
So I guess
WS.url("http://service/endpoint").post(Results.EmptyContent())
should do. (Didnt test)
Problem
I try to send an HTTP POST request to a service endpoint using Play2/Scala WS API. Since there is no parameters to be sent in the HTTP POST body, how can I send it using ``` WS.url("http://service/endpoint").post() ``` I have tried `post()` without argument but it gave me an error. Cannot write an instance of Unit to HTTP response. Try to define a Writeable[Unit] Can you please help on this ? thanks in advance...