mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-25 21:54:48 +00:00
Update pt-agent to implement new specs.
This commit is contained in:
@@ -20,8 +20,6 @@
|
||||
{
|
||||
package Percona::Test::Mock::UserAgent;
|
||||
|
||||
use Percona::Toolkit qw(Dumper);
|
||||
|
||||
sub new {
|
||||
my ($class, %args) = @_;
|
||||
my $self = {
|
||||
|
@@ -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",
|
||||
|
@@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user