Update _process_success_frame:
If it looks like JSON, parse it as JSON. If not assume normal success message and send it to cb inside a hash on the 'msg' key. Signed-off-by: Pedro Melo <melo@simplicidade.org>
This commit is contained in:
@@ -289,16 +289,17 @@ sub _process_success_frame {
|
||||
$self->nop;
|
||||
}
|
||||
else {
|
||||
if ($msg ne 'OK') {
|
||||
my $info = eval { JSON::XS::decode_json($msg) };
|
||||
my $info = { msg => $msg };
|
||||
if ($msg =~ m/^\s*[{]/) {
|
||||
$info = eval { JSON::XS::decode_json($msg) };
|
||||
unless ($info) {
|
||||
$self->_log_error(qq{unexpected/invalid JSON response '$msg'});
|
||||
return;
|
||||
}
|
||||
|
||||
my $cb = shift @{ $self->{success_cb_queue} || [] };
|
||||
$cb->($self, $info) if $cb;
|
||||
}
|
||||
|
||||
my $cb = shift @{ $self->{success_cb_queue} || [] };
|
||||
$cb->($self, $info) if $cb;
|
||||
}
|
||||
|
||||
return 'keep_reading_frames';
|
||||
|
||||
Reference in New Issue
Block a user