__PACKAGE__->mk_accessors(qw(serialize));
__PACKAGE__->config(
- 'default_view' => 'REST',
'stash_key' => 'rest',
'map' => {
'text/html' => 'YAML::HTML',
sub begin : ActionClass('Deserialize') { }
+sub end : ActionClass('Serialize') { }
+
=item status_ok
Returns a "200 OK" response. Takes an "entity" to serialize.
--- /dev/null
+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)',
+);
--- /dev/null
+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;