Get form parameters from a post request using spray/scala

Mike picture Mike · Oct 14, 2011 · Viewed 7.1k times · Source

I'm really new with all this Scala/Spray. With some testing I was able to get parameters from a Get request using the parameters function. However I'm trying to fetch some parameters sent from a POST request on the body of the request. It seems like parameters function is unable to fetch those values.

As an example, I'm trying to get this values "name=john&lastname=smith" from the post request body. What is the best option to get these values?

Thank you

Answer

Edi picture Edi · Jan 4, 2012

You could use [Form-Field-Filters] to extract parameters from POSTs

[Form-Field-Filters] https://github.com/spray/spray/wiki/Form-Field-Filters