From 83f596c22ab52285b662d5023d8f37863fe0773b Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 9 Oct 2019 18:54:27 +0200 Subject: [PATCH] TT#68300 Simplify the result method implementation Change-Id: Ia4bab392c231a7dabb08ce8715424d191f385cf7 --- lib/NGCP/API/Client.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/NGCP/API/Client.pm b/lib/NGCP/API/Client.pm index c3c9012..c56aadc 100644 --- a/lib/NGCP/API/Client.pm +++ b/lib/NGCP/API/Client.pm @@ -217,10 +217,14 @@ sub as_hash { sub result { my $self = shift; - my $location = $self->headers->header('Location') || ''; - return $self->is_success - ? sprintf "%s %s", $self->status_line, $location - : sprintf "%s %s", $self->status_line, $self->content; + my $content; + if ($self->is_success) { + $content = $self->headers->header('Location') // ''; + } else { + $content = $self->content; + } + + return sprintf "%s %s", $self->status_line, $content; } 1;