Catmandu-SRU

 view release on metacpan or  search on metacpan

t/lib/MockHTTPClient.pm  view on Meta::CPAN

package MockHTTPClient;

#ABSTRACT: HTTP::Tiny mockup class to return XML data from file based on a query
use Moo;

sub get {
    my ($self, $url) = @_;
    $url =~ /query=([^&]+)/;
    my $xml = do {local (@ARGV, $/) = "t/files/$1"; <>};
    {success => 1, status => 200, reason => 'OK', content => $xml,};
}

1;

t/lib/MockHTTPClientMany.pm  view on Meta::CPAN

package MockHTTPClientMany;

#ABSTRACT: HTTP::Tiny mockup class to return XML data from files based on queries
use Moo;

sub get {
    my ($self, $url) = @_;
    $url =~ /startRecord=([^&]+)/;
    my $xml = do {local (@ARGV, $/) = "t/files/$1.xml"; <>};
    {success => 1, status => 200, reason => 'OK', content => $xml,};
}

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.505 second using v1.00-cache-2.02-grep-82fe00e-cpan-da92000dfeb )