Re: How do I deflate content()?
ser <ser.avjcxb-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]> Fri, 16 Dec 2022 17:13:44 +0000
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Organization | Logitech Squeezebox Forums |
| Message-ID | <[email protected]> |
My repo is github.com/xxxserxxx/squeeze-remote-hass, and it has only one
change, for the authentication mechanism (previous HA used a bespoke
header; the newer versions use the standard `Authentication: Bearer`
tokens). Other than that, I've changed nothing except to add logging
messages. There are a number of functions that make calls, but the one
I'm messing with ("adding logging messages") is:
Code:
--------------------
my $http = Slim::Networking::SimpleAsyncHTTP->new(
sub {
my $response = shift;
my $params = $response->params('params');
my $result;
if ( $response->headers->content_type =~ /json/ ) {
$result = decode_json($response->content);
}
$cb->($result);
},
sub {
$log->error("Error (".$url."): $_[1]");
$cb->();
},
{
params => $params,
timeout => 5,
},
);
--------------------
It's that:
Code:
--------------------
$result = decode_json($response->content);
--------------------
That throws the error, and if I $log the content, it dumps out garbage
(a block of non-ASCII). If it's supposed to be deflating the content,
it's not.
Is this code using the correct API calls? It's an old project; AFAIK, it
may not even be calling the LMS helpers correctly.
------------------------------------------------------------------------
ser's Profile: http://forums.slimdevices.com/member.php?userid=73240
View this thread: http://forums.slimdevices.com/showthread.php?t=117244