Why does HTTP::Response::decoded_content sometimes return undef even when content() returns data? [closed]
I've used LWP capability to handle gzip encoded content as described here, but in some cases I randomly get unexpected results at least for the one website I've tested: $response->decoded_content
could become undefined while $response->content
still returns original gzip encoded response. Tried even without internal charset decoding (decoded_content(charset => 'none')
) with the same result.
This doesn't directly answer your question, but when I encounter things like this I look at the source of the module to see what it is doing and debug the code just like any other code. Looking at the decoded_content
method in HTTP::Message
shows you exactly what it is expecting. Check that your response has all of the things it expects.
Is the server perhaps not properly setting Content-Encoding in the response? In any case, take a look at the headers for both working and non-working responses and look for significant differences.
精彩评论