Permalink
Browse files

partial revert of e540a1f -- fixes RT#44641 (plus tests)

  • Loading branch information...
1 parent 85c2b64 commit 0ba737212e82994202544ac6fb61f6d0ffb96184 Hans Dieter Pearcey committed Mar 28, 2009
@@ -217,7 +217,6 @@ use Params::Validate qw(SCALAR OBJECT);
__PACKAGE__->mk_accessors(qw(serialize));
__PACKAGE__->config(
- 'default_view' => 'REST',
'stash_key' => 'rest',
'map' => {
'text/html' => 'YAML::HTML',
@@ -237,6 +236,8 @@ __PACKAGE__->config(
sub begin : ActionClass('Deserialize') { }
+sub end : ActionClass('Serialize') { }
+
=item status_ok
Returns a "200 OK" response. Takes an "entity" to serialize.
@@ -0,0 +1,21 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+use YAML::Syck;
+use FindBin;
+
+use lib ("$FindBin::Bin/lib", "$FindBin::Bin/../lib", "$FindBin::Bin/broken");
+use Test::Rest;
+
+my $t = Test::Rest->new(content_type => 'text/x-yaml');
+
+use_ok 'Catalyst::Test', 'Test::Catalyst::Action::REST';
+
+my $data = { your => 'face' };
+is_deeply(
+ Load(
+ request($t->put(url => '/rest/test', data => Dump($data)))->content
+ ),
+ { test => 'worked', data => $data },
+ 'round trip (deserialize/serialize)',
+);
@@ -0,0 +1,13 @@
+package Test::Catalyst::Action::REST::Controller::REST;
+
+use strict;
+use warnings;
+
+use base 'Catalyst::Controller::REST';
+
+sub test : Local {
+ my ($self, $c) = @_;
+ $self->status_ok($c, entity => { test => 'worked', data => $c->req->data });
+}
+
+1;

0 comments on commit 0ba7372

Please sign in to comment.