ype' => (
isa => Enum[qw{application/json application/xml application/yaml application/x-www-form-urlencoded}],
is => 'rw',
default => sub { 'application/json' },
);
has clientattrs => (
isa =>
$foo = RESTExample->new(
server => 'http://localhost:3000',
type => 'application/json',
clientattrs => {timeout => 5},
);
$foo->bar;
# controller
sub foo : Local {
my ($self
PUT
POST
DELETE
OPTIONS
Currently Role::REST::Client supports these encodings
application/json
application/x-www-form-urlencoded
application/xml
application/yaml
x-www-form-urlencoded only
(
isa => Enum[qw{application/json application/xml application/yaml application/x-www-form-urlencoded text/javascript}],
is => 'rw',
default => sub { 'application/json' },
);
has 'serializer' => (
> 'ro',
default => \&_set_serializer,
lazy => 1,
);
our %modules = (
'application/json' => {
module => 'JSON',
},
'application/xml' => {
module => 'XML::Simple',
},
'application/yaml' => {
n/x-www-form-urlencoded' => {
module => 'FORM',
},
'text/javascript' => {
module => 'JSON',
},
);
sub _set_serializer {
my $self = shift;
return unless $modules{$self->type};
my $m