httpclient - How do I read response headers + body from single POST using scala's dispatch lib -


I am trying to use a library to download a file through a http POST request.

I have been able to read the entire reaction body as a string,

  http (r> ~ {(x) => println ( Reading feedback header at x.getLines.mkString ("", \ n "," "))}  

  http (r> : & Gt; {(x) = & gt; println (x)}) and for a BufferedReader getting response body  
  Http (r> <> ({, x, c) = & gt; (New BufferedReader (New InputStreamReader (x, c)) ReadLine})  

I have answer headers and respondents How To Know About Going A Body Using the transmission lib? The docs are very rare and I'm new to Scala.

TIA

Michael

Dispatch uses a handler to control HTTP responses from a request. It provides several simple shortcuts to run regular tasks, Are mentioned in the form of generating an inputstream, as the string in the form of a string Utana or see the response headers. There is also a method, which creates two separate handlers and executes them on the same request. Here's how you can solve your problem using that handler:

  val ret = http (req> + {r = & gt; (R as_str, R>: & gt; {_ ("Return value is a tuple 2, in which case, a string that is the content of a web page and the second string whose value is I content-expression headers. 


Comments