Net-Async-Webservice-Common

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 - bump version requirements for Future (to get is_done) and Moo (to
   get non-ref defaults via constants instead of coderefs)

1.0.1     2014-07-29 11:19:55+01:00 Europe/London
 - use SingleEncoding (thanks sergeyromanov)

1.0.0     2014-06-25 11:11:57+01:00 Europe/London
 - first regular release

0.01_4    2014-06-24 09:54:46+01:00 Europe/London
 - make tests pass when IO::Socket::SSL is not installed

0.01_3    2014-06-23 09:55:46+01:00 Europe/London
 - avoid stealth dependency on Config::General, use a Perl "config
   file" for testing

0.01_2    2014-06-18 10:38:23+01:00 Europe/London
 - avoid package-block syntax, we don't want to exclude 5.10 and 5.12

0.01_1    2014-06-17 18:00:21+01:00 Europe/London
 - factored out common pieces from Net::Async::Webservice::{UPS,DHL}

lib/Net/Async/Webservice/Common/WithRequestWrapper.pm  view on Meta::CPAN

requires 'user_agent';


has ssl_options => (
    is => 'lazy',
    isa => HashRef,
);
sub _build_ssl_options {
    # this is to work around an issue with IO::Async::SSL, see
    # https://rt.cpan.org/Ticket/Display.html?id=96474
    eval "require IO::Socket::SSL" or return {};
    return { SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_PEER() }
}


sub request {
    state $argcheck = compile( Object, HTTPRequest );
    my ($self, $request) = $argcheck->(@_);

    my $response_future = $self->user_agent->do_request(
        request => $request,
        fail_on_error => 1,

t/tests/Net/Async/Webservice/Common/WithRequestWrapper.t  view on Meta::CPAN

                   methods(
                       request => $ua->last_call->{request},
                       response => undef,
                       more_info => 'random failure',
                   ),
               ),'webservice'],
               'correct exception')
        or diag p $f->failure;
};

my $has_ssl = eval "require IO::Socket::SSL";

subtest 'SSL' => sub {
    $ua->next_result([
        'done',
        HTTP::Response->new(200,'ok',[],'some content'),
    ]);
    my $f = $t->get('https://foo/');
    cmp_deeply($ua->last_call,
               {
                   request => all(



( run in 0.493 second using v1.01-cache-2.11-cpan-4d50c553e7e )