AnyEvent-HTTP-ScopedClient
view release on metacpan or search on metacpan
go to https://github.com/aanoaa/AnyEvent-HTTP-ScopedClient/issues for the roadmap and known issues.
v0.0.5 Sun Jun 23 22:03:40 2013 KST
- prevent 'newline' at 'Authorization' header
v0.0.4 Thu May 30 11:13:44 2013 KST
- uri_escape_utf8(request_body)
0.0.3 Fri Nov 30 10:04:43 2012 KST
- depend `Host` req header to `AnyEvent::HTTP`
0.0.2 Thu Oct 11 10:59:18 2012 KST
- support editing multiple header at once
- enhancement test
- tidied all source code
---
abstract: 'AnyEvent::HTTP wrapper'
author:
- 'Hyungsuk Hong <hshong@perl.kr>'
build_requires:
AnyEvent: 0
Test::More: 0
strict: 0
utf8: 0
warnings: 0
configure_requires:
ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.300034, CPAN::Meta::Converter version 2.131560'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: AnyEvent-HTTP-ScopedClient
Makefile.PL view on Meta::CPAN
"Try::Tiny" => 0,
"URI" => 0,
"URI::Escape" => 0,
"URI::QueryParam" => 0,
"namespace::autoclean" => 0
},
"TEST_REQUIRES" => {
"AnyEvent" => 0,
"Test::More" => 0,
"strict" => 0,
"utf8" => 0,
"warnings" => 0
},
"VERSION" => "0.0.5",
"test" => {
"TESTS" => "t/*.t"
}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
lib/AnyEvent/HTTP/ScopedClient.pm view on Meta::CPAN
# ABSTRACT: L<AnyEvent> based L<https://github.com/technoweenie/node-scoped-http-client>
use Moose;
use namespace::autoclean;
use URI;
use Try::Tiny;
use MIME::Base64;
use HTTP::Request;
use Encode qw/encode_utf8/;
use AnyEvent::HTTP;
use URI::QueryParam;
use URI::Escape;
has 'options' => (
is => 'ro',
isa => 'HashRef',
);
sub request {
lib/AnyEvent/HTTP/ScopedClient.pm view on Meta::CPAN
}
my %options = %{ $self->options };
try {
my %headers = %{ $options{headers} };
if ( 'HASH' eq ref($reqBody) ) {
my @pair;
# push @pair, "$_=$reqBody->{$_}" for ( keys %$reqBody );
push @pair, "$_=" . uri_escape_utf8( $reqBody->{$_} )
for ( keys %$reqBody );
$reqBody = join( '&', @pair );
}
my $sendingData
= ( $method =~ m/^P/ && $reqBody && length $reqBody > 0 ) ? 1 : 0;
$headers{'Content-Length'} = length $reqBody if $sendingData;
$headers{'Content-Type'} = 'application/x-www-form-urlencoded'
if ( $sendingData && !$headers{'Content-Type'} );
lib/AnyEvent/HTTP/ScopedClient.pm view on Meta::CPAN
}
print "\n";
print "$reqBody\n" if $sendingData;
}
http_request(
$method,
$options{url},
headers => \%headers,
body => $sendingData ? encode_utf8($reqBody) : undef,
$callback
);
}
catch {
$callback->($_) if $callback;
};
return $self;
}
t/scoped-client.t view on Meta::CPAN
use utf8;
use strict;
use warnings;
use Test::More tests => 2;
use AnyEvent;
use AnyEvent::HTTP::ScopedClient;
my $cv = AE::cv;
my $http = AnyEvent::HTTP::ScopedClient->new('http://www.naver.com/');
( run in 1.046 second using v1.01-cache-2.11-cpan-49f99fa48dc )