line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Copyright (c) 2018 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
|
|
25
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
73
|
|
12
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
57
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
11
|
use base 'HTTP::Response'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
554
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub decode_json { |
17
|
50
|
|
|
50
|
0
|
589
|
my ($self) = @_; |
18
|
|
|
|
|
|
|
|
19
|
50
|
|
|
|
|
175
|
my $type = $self->header('Content-Type'); |
20
|
50
|
|
|
|
|
470
|
my $content = $self->decoded_content; |
21
|
|
|
|
|
|
|
|
22
|
50
|
100
|
|
|
|
400
|
if ($self->code =~ /^[45]\d{2}$/) { |
23
|
3
|
|
66
|
|
|
41
|
$content ||= "@{[$self->code]} Unknown error"; |
|
1
|
|
|
|
|
4
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
|
|
40
|
die $content; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
47
|
100
|
66
|
|
|
424
|
if (defined $content && length $content) { |
29
|
38
|
100
|
|
|
|
271
|
if (lc($type) =~ qr{^application/json}i) { |
30
|
37
|
|
|
|
|
546
|
return JSON::decode_json($content); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
10
|
|
|
|
|
50
|
return $content; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |