If you're using Mojo, use ojo :)
use strict;
use warnings;
use ojo qw/ r g j /;
my $g = g( URL() );
print join "\n\n", $g, r( $g ), r( j( $g->body ) );
__END__
Mojo::Message::Response=HASH(0x1dec95c)
bless( {
"code" => 403,
"content" => bless( {
"asset" => bless( {
"auto_upgrade" => 1,
"content" => "{\"error\":{\"code\":403,\"message\":\"Invalid acc
+ess_token format\"}}",
"max_memory_size" => 262144
}, 'Mojo::Asset::Memory' ),
"auto_decompress" => 1,
"auto_relax" => 1,
"auto_upgrade" => 1,
"body" => 4,
"buffer" => "",
"chunk_len" => 0,
"chunk_state" => "finished",
"events" => {
"read" => [
sub { "DUMMY" }
]
},
"gz" => bless( do{\(my $o = 31422964)}, 'Compress::Raw::Zlib::infl
+ateStream' ),
"header_size" => 997,
"headers" => bless( {
"cache" => [],
"headers" => {
"access-control-allow-credentials" => [
"true"
],
"access-control-allow-headers" => [
"Accept, Content-Type, Origin, X-Requested-With, Authorizati
+on"
],
"access-control-allow-methods" => [
"GET, PUT, POST, DELETE, OPTIONS"
],
"access-control-expose-headers" => [
"Retsly-Session"
],
"cache-control" => [
"no-store, no-cache, must-revalidate, proxy-revalidate"
],
"connection" => [
"keep-alive"
],
"content-length" => [
62
],
"content-type" => [
"application/json; charset=utf-8; ieee754compatible=undefine
+d; odata.metadata=undefined; odata.streaming=undefined"
],
"date" => [
"Sat, 25 Jan 2020 07:28:22 GMT"
],
"expires" => [
0
],
"odata-version" => [
"4.0"
],
"pragma" => [
"no-cache"
],
"referrer-policy" => [
"origin-when-cross-origin"
],
"server" => [
"nginx/1.10.3 (Ubuntu)"
],
"strict-transport-security" => [
"max-age=31536000"
],
"surrogate-control" => [
"no-store"
],
"x-content-type-options" => [
"nosniff"
],
"x-download-options" => [
"noopen"
],
"x-frame-options" => [
"SAMEORIGIN"
],
"x-xss-protection" => [
"1; mode=block"
]
},
"max_line_size" => 8192,
"max_lines" => 100,
"names" => {
"access-control-allow-credentials" => "Access-Control-Allow-Cr
+edentials",
"access-control-allow-headers" => "Access-Control-Allow-Header
+s",
"access-control-allow-methods" => "Access-Control-Allow-Method
+s",
"access-control-expose-headers" => "Access-Control-Expose-Head
+ers",
"odata-version" => "OData-Version",
"pragma" => "Pragma",
"referrer-policy" => "Referrer-Policy",
"requestid" => "requestId",
"surrogate-control" => "Surrogate-Control",
"x-content-type-options" => "X-Content-Type-Options",
"x-download-options" => "X-Download-Options",
"x-frame-options" => "X-Frame-Options",
"x-xss-protection" => "X-XSS-Protection"
},
"state" => "finished"
}, 'Mojo::Headers' ),
"max_buffer_size" => 262144,
"post_buffer" => "",
"raw_size" => 1087,
"read" => $VAR1->{"content"}{"events"}{"read"}[0],
"real_size" => 79,
"size" => 79,
"state" => "finished"
}, 'Mojo::Content::Single' ),
"error" => {
"code" => 403,
"message" => "Forbidden"
},
"events" => {},
"finished" => 3,
"max_line_size" => 8192,
"max_message_size" => 2147483648,
"message" => "Forbidden",
"raw_size" => 1111,
"state" => "finished",
"version" => "1.1"
}, 'Mojo::Message::Response' )
{
"error" => {
"code" => 403,
"message" => "Invalid access_token format"
}
}
|