Bug 37308: Add user-agent for SUSHI outgoing requests

Signed-off-by: Belal Ahmadi <belal.ahmadi@uwl.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2024-07-10 15:07:22 +00:00 committed by Katrin Fischer
parent cf315751cf
commit 8175cccca2
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -27,6 +27,7 @@ use Koha::Exceptions;
use base qw(Koha::Object); use base qw(Koha::Object);
use Koha;
use Koha::ERM::EUsage::CounterFile; use Koha::ERM::EUsage::CounterFile;
use Koha::ERM::EUsage::CounterFiles; use Koha::ERM::EUsage::CounterFiles;
use Koha::ERM::EUsage::UsageTitles; use Koha::ERM::EUsage::UsageTitles;
@ -176,6 +177,7 @@ sub harvest_sushi {
my $url = $self->_build_url_query; my $url = $self->_build_url_query;
my $request = HTTP::Request->new( 'GET' => $url ); my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new; my $ua = LWP::UserAgent->new;
$ua->agent( 'Koha/' . Koha::version() );
my $response = $ua->simple_request($request); my $response = $ua->simple_request($request);
if ( $response->code >= 400 ) { if ( $response->code >= 400 ) {
@ -279,6 +281,7 @@ sub test_connection {
my $request = HTTP::Request->new( 'GET' => $url ); my $request = HTTP::Request->new( 'GET' => $url );
my $ua = LWP::UserAgent->new; my $ua = LWP::UserAgent->new;
$ua->agent( 'Koha/' . Koha::version() );
my $response = $ua->simple_request($request); my $response = $ua->simple_request($request);
if ( $response->{_rc} >= 400 ) { if ( $response->{_rc} >= 400 ) {