TT#68300 Return from next_page() if the request failed

We should not try to access the data, or decode it as JSON if the
request failed, because in that case the data will not be JSON and
we will get errors from the decoder.

Change-Id: Ibe663992a0487284d79e100b36392534fcbe88db
changes/49/34849/1
Guillem Jover 6 years ago
parent f69d3e8bc2
commit c9a496b8e5

@ -156,6 +156,8 @@ sub next_page {
undef $self->{_collection_url}; undef $self->{_collection_url};
return $res unless $res->is_success;
my $data = $res->as_hash(); my $data = $res->as_hash();
if ($data && ref($data) eq 'HASH') { if ($data && ref($data) eq 'HASH') {
my $new_url = URI->new($data->{_links}->{next}->{href}); my $new_url = URI->new($data->{_links}->{next}->{href});

Loading…
Cancel
Save