Skip to content

Dancer::Serializer: content deserialization fails silently instead of yielding an error #979

Open
@a-adam

Description

@a-adam

reopening issue #977, the suggested code to catch deserialization errors does not work.

post '/foo' => sub {
   my $data = params('body') or die "couldn't deserialize " . request()->body;
};

there is no such params('body') on successful deserialization. also, no param('body').
i do not see a safe way to detect such failures at this time -- especially since parameters
get merged together from URL and content.
hence, it would be necessary to try to deserialize manually to see if it fails...

IMO still, the right fix is to return 400 or a 4xx (suggesting it should be 500 was, of course, a mistake).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions