summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-22 18:10:39 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-22 18:10:39 +0200
commit52456d825d696b932a3edebe0da257380616046b (patch)
treeeb442466c5fec3f4a83950869a2d67c36e015953
parentfix format (diff)
downloadmoosex-net-api-52456d825d696b932a3edebe0da257380616046b.tar.gz
params can be strict or no strict
-rw-r--r--lib/MooseX/Net/API/Meta/Method.pm9
-rw-r--r--lib/MooseX/Net/API/Role/Serialization.pm2
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/MooseX/Net/API/Meta/Method.pm b/lib/MooseX/Net/API/Meta/Method.pm
index 9a9ab09..8643152 100644
--- a/lib/MooseX/Net/API/Meta/Method.pm
+++ b/lib/MooseX/Net/API/Meta/Method.pm
@@ -37,6 +37,11 @@ has params_in_url => (
     predicate => 'has_params_in_url',
     default   => 0
 );
+has strict => (
+    is => 'ro',
+    isa => 'Bool',
+    default => 1,
+);
 has authentication => (
     is        => 'ro',
     isa       => 'Bool',
@@ -167,6 +172,8 @@ sub _validate_before_execute {
 sub _check_params_before_run {
     my ($self, $args) = @_;
 
+    return if !$self->strict;
+
     # check if there is no undeclared param
     foreach my $arg (keys %$args) {
         if (!$self->find_request_parameter(sub {/$arg/})) {
@@ -204,7 +211,7 @@ sub _build_path {
             $path =~ s/(?:\/)?(?:\$|:)(\w+)$//;
         }
     }
-    $path =~ s/(?:\/)?(?:\$|:)(\w+)$//;
+    $path =~ s/(?:\/)?(?:\$|\\:)(\w+)$//;
     return $path;
 }
 
diff --git a/lib/MooseX/Net/API/Role/Serialization.pm b/lib/MooseX/Net/API/Role/Serialization.pm
index fe86b9f..f10a101 100644
--- a/lib/MooseX/Net/API/Role/Serialization.pm
+++ b/lib/MooseX/Net/API/Role/Serialization.pm
@@ -23,6 +23,8 @@ has serializers => (
 sub get_content {
     my ($self, $result) = @_;
 
+    return undef unless $result->content;
+
     my $content_type = $self->api_format // $result->header('Content-Type');
     $content_type =~ s/(;.+)$//;