X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FActionRole%2FConsumesContent.pm;h=28b535071b7d6287702512783e149593bcf9b673;hp=07315c8bb441f6459d181f274a3ac2368493a048;hb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063;hpb=9868e0a0023cc8b598d60f150ea367e0056a65f3 diff --git a/lib/Catalyst/ActionRole/ConsumesContent.pm b/lib/Catalyst/ActionRole/ConsumesContent.pm index 07315c8..28b5350 100644 --- a/lib/Catalyst/ActionRole/ConsumesContent.pm +++ b/lib/Catalyst/ActionRole/ConsumesContent.pm @@ -65,7 +65,7 @@ sub can_consume { around 'list_extra_info' => sub { my ($orig, $self, @args) = @_; return { - %{ $self->$orig(@args) }, + %{ $self->$orig(@args) }, CONSUMES => $self->allowed_content_types, }; }; @@ -87,7 +87,7 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type sub is_json : Chained('start') Consumes('application/json') { ... } sub is_urlencoded : Chained('start') Consumes('application/x-www-form-urlencoded') { ... } sub is_multipart : Chained('start') Consumes('multipart/form-data') { ... } - + ## Alternatively, for common types... sub is_json : Chained('start') Consume(JSON) { ... } @@ -95,13 +95,13 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type sub is_multipart : Chained('start') Consumes(Multipart) { ... } ## Or allow more than one type - + sub is_more_than_one : Chained('start') : Consumes('application/x-www-form-urlencoded') : Consumes('multipart/form-data') { - ## ... + ## ... } 1; @@ -109,7 +109,7 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type =head1 DESCRIPTION This is an action role that lets your L match on the content -type of the incoming request. +type of the incoming request. Generally when there's a PUT or POST request, there's a request content body with a matching MIME content type. Commonly this will be one of the types