The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

CatalystX::RequestModel::ContentBodyParser - Content Parser base class

SYNOPSIS

    TBD

DESCRIPTION

Base class for content parsers. Basically we need the ability to take a given POSTed or PUTed (or PATCHed even I guess) content body and normalized it to a hash of data that can be used to instantiate the request model. As well you need to be able to read the meta data for each field and do things like flatten arrays (or inflate them, etc) and so forth.

This is lightly documented for now but there's not a lot of code and you can refer to the packaged subclasses of this for hints on how to deal with your odd incoming content types.

EXCEPTIONS

This class can throw the following exceptions:

Invalid JSON in value

If you mark an attribute as "expand=>'JSON'" and the value isn't valid JSON then we throw an CatalystX::RequestModel::Utils::InvalidJSONForValue exception which if you are using CatalystX::Errors will be converted into a HTTP 400 Bad Request response (and also logging to the error log the JSON parsing error).

Invalid request parameter not indexed

If a request parameter is marked as indexed but no indexed values (not arrayref) are found we throw CatalystX::RequestModel::Utils::InvalidRequestNamespace

Invalid request no namespace

If your request model defines a namespace but there's no matching namespace in the request we throw a CatalystX::RequestModel::Utils::InvalidRequestNamespace.

METHODS

This class defines the following public API

AUTHOR

See CatalystX::RequestModel.

COPYRIGHT

See CatalystX::RequestModel.

LICENSE

See CatalystX::RequestModel.