= shift;
$self->_request(
method => 'post',
'Content-Type' => 'application/json',
Accept => 'application/json',
@_
);
}
sub get {
my $self = shift;
$self->_request(
method => 'get',
'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8',
Accept => 'application/json',
@_
);
}
sub _request {
my ($self, %args) = @_;
$self->request_cb(\%args) if $self->can('requ
lsif ($res->content_type eq 'application/json') {
my $response = $self->graft('response', $res->decoded_content);
return $self->_return_error('Invalid JSON content returned', $res) if !$response;