3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Util/LWPUserAgentCached: minor style clean-up

This commit is contained in:
Pragmatic Software 2020-02-08 20:53:05 -08:00
parent c6f3a9aab4
commit 8c654bb956

View File

@ -40,9 +40,11 @@ sub request {
my ($self, @args) = @_;
my $request = $args[0];
return $self->SUPER::request(@args) if $request->method ne 'GET';
my $uri = $request->uri->as_string;
my $cached = $self->{cache}->get($uri);
return HTTP::Response->parse($cached) if defined $cached;
my $res = $self->SUPER::request(@args);
$self->{cache}->set($uri, $res->as_string) if $res->code eq HTTP::Status::RC_OK;
return $res;