Update pt-agent to implement new specs.

This commit is contained in:
Daniel Nichter
2013-01-31 17:00:38 -07:00
parent 24e505a43d
commit 3f4a02e1fb
10 changed files with 596 additions and 448 deletions

View File

@@ -20,8 +20,6 @@
{
package Percona::Test::Mock::UserAgent;
use Percona::Toolkit qw(Dumper);
sub new {
my ($class, %args) = @_;
my $self = {

View File

@@ -295,7 +295,7 @@ sub _request {
if ( !($response->code >= 200 && $response->code < 400) ) {
die Percona::WebAPI::Exception::Request->new(
method => $method,
link => $link,
url => $link,
content => $content,
status => $response->code,
error => "Failed to $method $link",

View File

@@ -47,14 +47,14 @@ sub as_hashref {
}
sub as_json {
my $resource = shift;
my ($resource, %args) = @_;
my $json = JSON->new;
my $json = $args{json} || JSON->new;
$json->allow_blessed([]);
$json->convert_blessed([]);
return $json->encode(
ref $resource eq 'ARRAY' ? $resource : as_hashref($resource)
ref $resource eq 'ARRAY' ? $resource : as_hashref($resource, %args)
);
}