frapi/frapi — pull request #97 by dshafik (2012-01-12 06:40:34+00:00)
Title: A fix for passing in JSON/XML as request body and parsing as data

When doing `parse_str(file_get_contents("php://input"), $data)` it creates an array like:

array(
"{json:string}" => ""
)

If args are also present along with the body, they are in the parse_str array before the body.

This means that `empty($data)` is returning false.

This fix checks the last element for being empty, along with the $inputFormat we can make a pretty good guess that it's meant to be parsed.