App-Adenosine
view release on metacpan or search on metacpan
lib/App/Adenosine.pm view on Meta::CPAN
package App::Adenosine;
$App::Adenosine::VERSION = '2.002000';
use strict;
use warnings;
# ABSTRACT: Handy CLI HTTP tool
use URI;
use Getopt::Long qw(:config pass_through no_ignore_case);
use File::Path 'mkpath';
use URI::Escape 'uri_escape';
use File::Spec::Functions 'splitpath';
use Path::Class;
use Text::ParseWords;
use Scalar::Util 'blessed';
use Module::Runtime 'use_module';
our $verb_regex = '(?:HEAD|OPTIONS|GET|DELETE|PUT|POST|TRACE|PATCH)';
sub verbose { $_[0]->{verbose} }
sub plugins { @{$_[0]->{plugins}} }
lib/App/Adenosine.pm view on Meta::CPAN
$data = file($fn)->slurp;
unlink $fn;
}
push @extra, '--data-binary' if $data;
push @extra, '-I' if $action eq 'HEAD';
my $_path = $uri_base;
$_path =~ s/\*/$path/;
$query = uri_escape($query) if $quote;
push @extra, $self->host_method_config( $self->host($uri_base), $action );
$query = "?$query" if $query;
my @curl = @{$self->curl_command({
method => $action,
data => $data,
cookie_jar => $self->cookie_jar($uri_base),
rest => \@extra,
TestAdenosine->new({ argv => [qw(HEAD -u)], @noxdg });
cmp_deeply(\@TestAdenosine::curl_options, [
qw(curl -sLv -X HEAD -b), $c, '-c', $c, qw(
-u -I https://google.com/user//1),
], 'HEAD adds -I');
TestAdenosine->new({ argv => [qw(GET -q foo&bar)], @noxdg });
cmp_deeply(\@TestAdenosine::curl_options, [
qw(curl -sLv -X GET -b), $c, '-c', $c, qw(
-H ), 'Accept: text/html', 'https://google.com/user//1?foo%26bar',
], 'GET escaped');
TestAdenosine->new({ argv => [qw(GET -Q -q foo&bar)], @noxdg });
cmp_deeply(\@TestAdenosine::curl_options, [
qw(curl -sLv -X GET -b), $c, '-c', $c, qw(
-H ), 'Accept: text/html', 'https://google.com/user//1?foo&bar',
], 'GET not escaped');
{
local $ENV{XDG_CONFIG_HOME} = "$ENV{HOME}/.config";
my $c = "$ENV{XDG_CONFIG_HOME}/resty/c/google.com";
$c =~ s(/)(\\)g if $^O eq 'MSWin32';
TestAdenosine->new({ argv => [qw(GET foo)], });
cmp_deeply(\@TestAdenosine::curl_options, [
qw(curl -sLv -X GET -b), $c, '-c', $c, qw(
-H ), 'Accept: text/html', 'https://google.com/user/foo/1',
], 'GET not escaped');
}
done_testing;
BEGIN {
package TestAdenosine;
use strict;
use warnings;
if ($] >= 5.010) {
( run in 0.620 second using v1.01-cache-2.11-cpan-c21f80fb71c )