[2.0] request.body.asText always EMPTY

165 views
Skip to first unread message

oblivion

unread,
Jan 7, 2012, 8:09:34 PM1/7/12
to play-framework
Hi,

I'm trying to follow the json-examples in the wiki, but sending some
data via:

$.post(url, {json:JSON.stringify(json)}, function (json) {...}

I get NO data in the controller:

request.body.asText.map(// NOTHING HERE)

The above example only works if I hassle around with asUrlFormEncoded:

request.body.asUrlFormEncoded.map(
_.get("json").map(_.headOption.map {
json => {
for {
// tons of code to deal with here
}...

Ivan Meredith

unread,
Jan 8, 2012, 1:16:26 AM1/8/12
to play-fr...@googlegroups.com
That api is a bit broken imo. asText doesnt mean it will be converted
to text. It means the content type somehow matched a specific case
class that puts it in the Text case class..

> --
> You received this message because you are subscribed to the Google Groups "play-framework" group.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
>

Reply all
Reply to author
Forward
0 new messages