protected function getRequestData(Request $request, $inflection = 'camelize')
    {
        switch ($request->headers->get('content-type')) {

            case 'application/json':
                if (!($data = @json_decode($request->getContent(), true))
                    && ($error = json_last_error()) != JSON_ERROR_NONE
                ) {
                    throw new HttpException(400, sprintf(
                        'Invalid submitted json data, error %s : %s',
                        $error,
                        json_last_error_msg()
                    ));
                }

                break;
            default:
                $data = array_replace_recursive(
                    $request->request->all(),
                    $request->files->all()
                );
                break;
        }

        // data camel case normalization
        return $inflection && $this->container->has('majora.inflector')?
            $this->container->get('majora.inflector')->normalize($data, $inflection) :
            $data
        ;
    }