HTTP post request using dispatcher

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

HTTP post request using dispatcher


I'm using dispatch-http_2.8.1, version 0.7.8. I have tested the POST request using Curl. Following is the basic structure of my POST request

<host/path> -d <json object> -H "Content-Type: application/json".

using liftweb i can encode a map to a json object and have it as a String. Then I use the following scala code to my task.
I have a issue with line 3

1.   val req = :/("localhost", 8080)
2.   req./("myapp")
3.    req.<<<( , "application/json")
4.  Http(req.POST >>> System.out)

In line number 3. req.<<< is expecting a File and a String. String to specify content type.  But once I encoded I dont have a File but a encoded string of Json object. Can you guide me, what should a I in order to specify my POST request correctly.