Sending a custom https POST request when sending (+ cookies, + headers)

There is some documentation about sending a mail request in the manager http://dispatch.databinder.net/Combined+Pages.html , but so far this is not clear. What are myRequest and myPost?

I want to send a request to send https + add cookies manually through the headers + add some customs headers, such as form data, etc., and then read the answer by reading the headers and cookies.

I only know how to prepare the URL for sending the mail request:

val url = host(myUrl + "?check=1&val1=123").secure

What should I do next?

+4
source share
1 answer

Async Http Client. myRequest :

 val myRequest = url("http://example.com/some/path")

- com.ning.http.client.RequestBuilder.

POST RequestBuilder POST. myPost:

def myPost = myRequest.POST

, Dispatch . Dispatch .

, POST , , , <<(values) :

val params = Map("param1" -> "val1", "param2" -> "val2") 
val req = url("http://www.example.com/some/path" <<(params)

, , <:<(map) :

val headers = Map("x-custom1" -> "val1", "x-custom2" -> "val2") 
val req = url("http://www.example.com/some/path" <<(params) <:<(headers)

: , POST RequestBuilder. POST setMethod RequestBuilder. . dispatch.MethodVerbs.

+9

All Articles