line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright (c) 2019 cPanel, L.L.C. |
3
|
|
|
|
|
|
|
# All rights reserved. |
4
|
|
|
|
|
|
|
# http://cpanel.net/ |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Distributed under the terms of the MIT license. See the LICENSE file for |
7
|
|
|
|
|
|
|
# further details. |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
package OpenStack::Client::Response; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
26
|
use strict; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
62
|
|
12
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
68
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
12
|
use base 'HTTP::Response'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
541
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub decode_json { |
17
|
50
|
|
|
50
|
0
|
587
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
50
|
|
|
|
|
116
|
my $type = $self->header('Content-Type'); |
20
|
50
|
|
|
|
|
431
|
my $content = $self->decoded_content; |
21
|
|
|
|
|
|
|
|
22
|
50
|
100
|
|
|
|
403
|
if ($self->code =~ /^[45]\d{2}$/) { |
23
|
3
|
|
66
|
|
|
25
|
$content ||= "@{[$self->code]} Unknown error"; |
|
1
|
|
|
|
|
4
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
36
|
die $content; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
47
|
100
|
66
|
|
|
395
|
if (defined $content && length $content) { |
29
|
38
|
100
|
|
|
|
274
|
if (lc($type) =~ qr{^application/json}i) { |
30
|
37
|
|
|
|
|
563
|
return JSON::decode_json($content); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
47
|
return $content; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |