Add debug log when request API
This commit is contained in:
parent
87a728b634
commit
ff0dc53738
@ -10,6 +10,11 @@ use LWP::UserAgent;
|
||||
use XML::LibXML;
|
||||
use XML::SAX::ParserFactory;
|
||||
|
||||
use constant API_URL => "https://noyce.acu.epita.fr/api/";
|
||||
#use constant API_URL => "https://rasmus.acu.epita.fr/intra/api/";
|
||||
|
||||
use ACU::Log;
|
||||
|
||||
sub make_response($$)
|
||||
{
|
||||
my $doc = XML::LibXML::Document->new('1.0');
|
||||
@ -50,7 +55,9 @@ sub get($$)
|
||||
my $next = shift;
|
||||
my $url = shift;
|
||||
my $ua = LWP::UserAgent->new;
|
||||
my $req = GET 'https://lerdorf.acu.epita.fr/intra/api/' . $url;
|
||||
|
||||
ACU::Log::do_debug ('GET Request to ' . API_URL . $url);
|
||||
my $req = GET API_URL . $url;
|
||||
|
||||
return parse($next, $ua->request($req)->content);
|
||||
}
|
||||
@ -60,7 +67,9 @@ sub send($$@)
|
||||
my $next = shift;
|
||||
my $url = shift;
|
||||
my $ua = LWP::UserAgent->new;
|
||||
my $req = POST 'https://lerdorf.acu.epita.fr/intra/api/' . $url, @_;
|
||||
|
||||
ACU::Log::do_debug ('POST Request to ' . API_URL . $url);
|
||||
my $req = POST API_URL . $url, @_;
|
||||
|
||||
return parse($next, $ua->request($req)->content);
|
||||
}
|
||||
|
Reference in New Issue
Block a user