}
use JSON::MaybeXS qw/decode_json/;
-use LWP::Simple qw/get/;
+use HTTP::Tiny;
use PerlX::Maybe;
use WWW::BackpackTF::Currency;
use WWW::BackpackTF::Item;
use WWW::BackpackTF::User;
+my $ht = HTTP::Tiny->new(agent => "WWW-BackpackTF/$VERSION");
+
sub request {
my ($self, $url, %params) = @_;
$params{key} = $self->{key} if $self->{key};
$url = $self->{base} . $url;
$url .= "&$_=$params{$_}" for keys %params;
- my $response = decode_json(get $url)->{response};
+ my $htr = $ht->get($url);
+ die $htr->{reason} unless $htr->{success};
+ my $response = decode_json($htr->{content})->{response};
die $response->{message} unless $response->{success};
$response
}
use strict;
use warnings;
-use LWP::Online ':skip_all';
+use Test::RequiresInternet 'backpack.tf' => 80;
use Test::More tests => 6;
use WWW::BackpackTF;