Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rename *AGAIN*

  • Loading branch information...
commit 9d7ae513841b4971889f5625b46e6a36d35fd5b3 1 parent eca7520
@miyagawa authored
Showing with 150 additions and 254 deletions.
  1. +1 −1  Changes
  2. +25 −24 MANIFEST
  3. +3 −3 Makefile.PL
  4. +12 −156 README
  5. +39 −0 lib/HTTPx/Weblet.pm
  6. +21 −21 lib/{Piglet → HTTPx/Weblet}/Request.pm
  7. +1 −1  lib/{Piglet → HTTPx/Weblet}/Request/BodyParser.pm
  8. +2 −2 lib/{Piglet → HTTPx/Weblet}/Request/Upload.pm
  9. +11 −11 lib/{Piglet → HTTPx/Weblet}/Response.pm
  10. +1 −1  t/00_compile.t
  11. 0  t/{Piglet-Request → Request}/body.t
  12. 0  t/{Piglet-Request → Request}/content.t
  13. 0  t/{Piglet-Request → Request}/cookie.t
  14. +2 −2 t/{Piglet-Request → Request}/double_port.t
  15. 0  t/{Piglet-Request → Request}/hostname.t
  16. 0  t/{Piglet-Request → Request}/many_upload.t
  17. +3 −3 t/{Piglet-Request → Request}/new.t
  18. 0  t/{Piglet-Request → Request}/parameters.t
  19. 0  t/{Piglet-Request → Request}/params.t
  20. +2 −2 t/{Piglet-Request → Request}/path_info.t
  21. 0  t/{Piglet-Request → Request}/raw_body.t
  22. +2 −2 t/{Piglet-Request → Request}/raw_uri.t
  23. 0  t/{Piglet-Request → Request}/readbody.t
  24. +2 −2 t/{Piglet-Request → Request}/upload-basename.t
  25. +8 −8 t/{Piglet-Request → Request}/upload.t
  26. 0  t/{Piglet-Request → Request}/uri.t
  27. +2 −2 t/{Piglet-Response → Response}/body.t
  28. +6 −6 t/{Piglet-Response → Response}/new.t
  29. +3 −3 t/{Piglet-Response → Response}/redirect.t
  30. +2 −2 t/{Piglet-Response → Response}/response.t
  31. +2 −2 t/Utils.pm
View
2  Changes
@@ -1,4 +1,4 @@
-Revision history for Perl extension Piglet::Request
+Revision history for Perl extension HTTPx::Weblet::Request
0.09 Sun Dec 13 10:34:33 PST 2009
- Added $req->session accessor
View
49 MANIFEST
@@ -22,35 +22,36 @@ inc/Test/Builder/Module.pm
inc/Test/Exception.pm
inc/Test/More.pm
inc/Test/Requires.pm
-lib/Plack/Request.pm
-lib/Plack/Request/BodyParser.pm
-lib/Plack/Request/Upload.pm
-lib/Plack/Response.pm
+lib/HTTPx/Weblet.pm
+lib/HTTPx/Weblet/Request.pm
+lib/HTTPx/Weblet/Request/BodyParser.pm
+lib/HTTPx/Weblet/Request/Upload.pm
+lib/HTTPx/Weblet/Response.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
t/00_compile.t
-t/Plack-Request/body.t
-t/Plack-Request/content.t
-t/Plack-Request/cookie.t
-t/Plack-Request/double_port.t
-t/Plack-Request/hostname.t
-t/Plack-Request/many_upload.t
-t/Plack-Request/new.t
-t/Plack-Request/parameters.t
-t/Plack-Request/params.t
-t/Plack-Request/path_info.t
-t/Plack-Request/raw_body.t
-t/Plack-Request/raw_uri.t
-t/Plack-Request/readbody.t
-t/Plack-Request/upload-basename.t
-t/Plack-Request/upload.t
-t/Plack-Request/uri.t
-t/Plack-Response/body.t
-t/Plack-Response/new.t
-t/Plack-Response/redirect.t
-t/Plack-Response/response.t
+t/Request/body.t
+t/Request/content.t
+t/Request/cookie.t
+t/Request/double_port.t
+t/Request/hostname.t
+t/Request/many_upload.t
+t/Request/new.t
+t/Request/parameters.t
+t/Request/params.t
+t/Request/path_info.t
+t/Request/raw_body.t
+t/Request/raw_uri.t
+t/Request/readbody.t
+t/Request/upload-basename.t
+t/Request/upload.t
+t/Request/uri.t
+t/Response/body.t
+t/Response/new.t
+t/Response/redirect.t
+t/Response/response.t
t/Utils.pm
xt/perlcritic.t
xt/pod.t
View
6 Makefile.PL
@@ -1,7 +1,7 @@
use inc::Module::Install;
-name 'Plack-Request';
-all_from 'lib/Plack/Request.pm';
-readme_from 'lib/Plack/Request.pm';
+name 'HTTPx-Weblet';
+all_from 'lib/HTTPx/Weblet.pm';
+readme_from 'lib/HTTPx/Weblet.pm';
requires 'CGI::Simple::Cookie';
requires 'HTTP::Headers';
requires 'HTTP::Request';
View
168 README
@@ -1,169 +1,25 @@
NAME
- Piglet::Request - Portable HTTP request object from PSGI env hash
-
-SYNOPSIS
- use Piglet::Request;
-
- sub psgi_handler {
- my $env = shift;
- my $req = Piglet::Request->new($env);
- my $res = $req->new_response(200);
- $res->content_type('text/html');
- $res->body("Hello World");
- return $res->finalize;
- }
+ HTTPx::Weblet - HTTP::Engine-like request and response objects for PSGI
DESCRIPTION
- Piglet::Request provides a consistent API for request objects across web
- server environments.
-
-CAVEAT
- Note that this module is intended to be used by web application
- framework developers rather than application developers (end users).
- Writing your web application directly using Piglet::Request is certainly
- possible but not recommended: it's like doing so with mod_perl's
- Apache::Request: yet too low level.
-
- If you're writing a web application, not a framework, then you're
- encouraged to use one of the web application frameworks that support
- PSGI, or use HTTP::Engine if you want to write a micro web server
- application.
-
- Also, even if you're a framework developer, you probably want to handle
- Cookies and file uploads in your own way: Piglet::Request gives you a
- simple API to deal with these things but ultimately you probably want to
- implement those in your own code.
-
-METHODS
- new
- Piglet::Request->new( $psgi_env );
-
-ATTRIBUTES
- address
- Returns the IP address of the client.
-
- cookies
- Returns a reference to a hash containing the cookies
-
- method
- Contains the request method ("GET", "POST", "HEAD", etc).
-
- protocol
- Returns the protocol (HTTP/1.0 or HTTP/1.1) used for the current
- request.
-
- request_uri
- Returns the request uri (like $ENV{REQUEST_URI})
-
- query_parameters
- Returns a reference to a hash containing query string (GET)
- parameters. Values can be either a scalar or an arrayref containing
- scalars.
-
- secure
- Returns true or false, indicating whether the connection is secure
- (https).
-
- uri Returns a URI object for the current request. Stringifies to the URI
- text.
-
- user
- Returns REMOTE_USER.
-
- raw_body
- Returns string containing body(POST).
-
- headers
- Returns an HTTP::Headers object containing the headers for the
- current request.
-
- hostname
- Returns the hostname of the client.
-
- parameters
- Returns a reference to a hash containing GET and POST parameters.
- Values can be either a scalar or an arrayref containing scalars.
-
- uploads
- Returns a reference to a hash containing uploads. Values can be
- either a Piglet::Request::Upload object, or an arrayref of
- Piglet::Request::Upload objects.
-
- content_encoding
- Shortcut to $req->headers->content_encoding.
+ HTTPx::Weblet is a toolkit that contains HTTP::Engine-like Request and
+ Response for PSGI web applications. This is an *old* implementation of
+ how Plack::Request was written, based on HTTP::Engine::Request and
+ HTTP::Engine::Response.
- content_length
- Shortcut to $req->headers->content_length.
-
- content_type
- Shortcut to $req->headers->content_type.
-
- header
- Shortcut to $req->headers->header.
-
- referer
- Shortcut to $req->headers->referer.
-
- user_agent
- Shortcut to $req->headers->user_agent.
-
- cookie
- A convenient method to access $req->cookies.
-
- $cookie = $req->cookie('name');
- @cookies = $req->cookie;
-
- param
- Returns GET and POST parameters with a CGI.pm-compatible param
- method. This is an alternative method for accessing parameters in
- $req->parameters.
-
- $value = $req->param( 'foo' );
- @values = $req->param( 'foo' );
- @params = $req->param;
-
- Like CGI, and unlike earlier versions of Catalyst, passing multiple
- arguments to this method, like this:
-
- $req->param( 'foo', 'bar', 'gorch', 'quxx' );
-
- will set the parameter "foo" to the multiple values "bar", "gorch"
- and "quxx". Previously this would have added "bar" as another value
- to "foo" (creating it if it didn't exist before), and "quxx" as
- another value for "gorch".
-
- path
- Returns the path, i.e. the part of the URI after $req->base, for the
- current request.
-
- upload
- A convenient method to access $req->uploads.
-
- $upload = $req->upload('field');
- @uploads = $req->upload('field');
- @fields = $req->upload;
-
- for my $upload ( $req->upload('field') ) {
- print $upload->filename;
- }
-
- new_response
- my $res = $req->new_response;
-
- Creates a new Plack::Response by default. Handy to remove dependency
- on Plack::Response in your code for easy subclassing and duck typing
- in web application frameworks, as well as overriding Response
- generation in middlewares.
+ New middleware authors and web application framework authors are
+ recommended to take a look and upgrade to the latest Plack::Request.
AUTHORS
Kazuhiro Osawa
Tokuhiro Matsuno
-SEE ALSO
- Plack::Response HTTP::Request, Catalyst::Request
+ Tatsuhiko Miyagawa
LICENSE
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
+ This software is licensed under the same terms as Perl.
+
+SEE ALSO
+ Plack::Request HTTP::Engine
View
39 lib/HTTPx/Weblet.pm
@@ -0,0 +1,39 @@
+package HTTPx::Weblet;
+use strict;
+use 5.008001;
+our $VERSION = "0.1000";
+
+__END__
+
+=head1 NAME
+
+HTTPx::Weblet - HTTP::Engine-like request and response objects for PSGI
+
+=head1 DESCRIPTION
+
+HTTPx::Weblet is a toolkit that contains L<HTTP::Engine>-like Request
+and Response for PSGI web applications. This is an I<old>
+implementation of how L<Plack::Request> was written, based on
+L<HTTP::Engine::Request> and L<HTTP::Engine::Response>.
+
+New middleware authors and web application framework authors are
+recommended to take a look and upgrade to the latest L<Plack::Request>.
+
+=head1 AUTHORS
+
+Kazuhiro Osawa
+
+Tokuhiro Matsuno
+
+Tatsuhiko Miyagawa
+
+=head1 LICENSE
+
+This software is licensed under the same terms as Perl.
+
+=head1 SEE ALSO
+
+L<Plack::Request> L<HTTP::Engine>
+
+=cut
+
View
42 lib/Piglet/Request.pm → lib/HTTPx/Weblet/Request.pm
@@ -1,4 +1,4 @@
-package Piglet::Request;
+package HTTPx::Weblet::Request;
use strict;
use warnings;
use 5.008_001;
@@ -9,7 +9,7 @@ use URI::QueryParam;
use Carp ();
use Socket qw[AF_INET inet_aton]; # for _build_hostname
-use Piglet::Request::Upload;
+use HTTPx::Weblet::Request::Upload;
use URI;
sub new {
@@ -73,8 +73,8 @@ sub query_parameters {
sub _body_parser {
my $self = shift;
unless (defined $self->{_body_parser}) {
- require Piglet::Request::BodyParser;
- $self->{_body_parser} = Piglet::Request::BodyParser->new( $self->env );
+ require HTTPx::Weblet::Request::BodyParser;
+ $self->{_body_parser} = HTTPx::Weblet::Request::BodyParser->new( $self->env );
}
$self->{_body_parser};
}
@@ -217,7 +217,7 @@ sub _build_uploads {
my $headers = HTTP::Headers->new( %{ $upload->{headers} } );
push(
@uploads,
- Piglet::Request::Upload->new(
+ HTTPx::Weblet::Request::Upload->new(
headers => $headers,
tempname => $upload->{tempname},
size => $upload->{size},
@@ -376,15 +376,15 @@ sub path { shift->uri->path(@_) }
sub new_response {
my $self = shift;
- require Piglet::Response;
- Piglet::Response->new(@_);
+ require HTTPx::Weblet::Response;
+ HTTPx::Weblet::Response->new(@_);
}
sub content {
my ( $self, @args ) = @_;
if ( @args ) {
- Carp::croak "The HTTP::Request method 'content' is unsupported when used as a writer, use Piglet::RequestBuilder";
+ Carp::croak "The HTTP::Request method 'content' is unsupported when used as a writer, use HTTPx::Weblet::RequestBuilder";
} else {
return $self->raw_body;
}
@@ -395,30 +395,30 @@ __END__
=head1 NAME
-Piglet::Request - Portable HTTP request object from PSGI env hash
+HTTPx::Weblet::Request - Portable HTTP request object from PSGI env hash
=head1 SYNOPSIS
- use Piglet::Request;
+ use HTTPx::Weblet::Request;
my $env = shift; # PSGI env
- my $req = Piglet::Request->new($env);
+ my $req = HTTPx::Weblet::Request->new($env);
my $path_info = $req->path_info;
my $query = $req->param('query');
- my $res = $req->new_response(200); # new Piglet::Response
+ my $res = $req->new_response(200); # new HTTPx::Weblet::Response
=head1 DESCRIPTION
-L<Piglet::Request> provides a consistent API for request objects across
+L<HTTPx::Weblet::Request> provides a consistent API for request objects across
web server environments.
=head1 CAVEAT
Note that this module is intended to be used by web application
framework developers rather than application developers (end
-users). Writing your web application directly using Piglet::Request is
+users). Writing your web application directly using HTTPx::Weblet::Request is
certainly possible but not recommended: it's like doing so with
mod_perl's Apache::Request: yet too low level.
@@ -428,7 +428,7 @@ PSGI, or use L<HTTP::Engine> if you want to write a micro web server
application.
Also, even if you're a framework developer, you probably want to
-handle Cookies and file uploads in your own way: Piglet::Request gives
+handle Cookies and file uploads in your own way: HTTPx::Weblet::Request gives
you a simple API to deal with these things but ultimately you probably
want to implement those in your own code.
@@ -436,7 +436,7 @@ want to implement those in your own code.
=head2 new
- Piglet::Request->new( $psgi_env );
+ HTTPx::Weblet::Request->new( $psgi_env );
=head1 ATTRIBUTES
@@ -500,8 +500,8 @@ be either a scalar or an arrayref containing scalars.
=item uploads
Returns a reference to a hash containing uploads. Values can be either a
-L<Piglet::Request::Upload> object, or an arrayref of
-L<Piglet::Request::Upload> objects.
+L<HTTPx::Weblet::Request::Upload> object, or an arrayref of
+L<HTTPx::Weblet::Request::Upload> objects.
=item content_encoding
@@ -573,8 +573,8 @@ A convenient method to access $req->uploads.
my $res = $req->new_response;
-Creates a new L<Piglet::Response> by default. Handy to remove
-dependency on L<Piglet::Response> in your code for easy subclassing and
+Creates a new L<HTTPx::Weblet::Response> by default. Handy to remove
+dependency on L<HTTPx::Weblet::Response> in your code for easy subclassing and
duck typing in web application frameworks, as well as overriding
Response generation in middlewares.
@@ -588,7 +588,7 @@ Tokuhiro Matsuno
=head1 SEE ALSO
-L<Piglet::Response> L<HTTP::Request>, L<Catalyst::Request>
+L<HTTPx::Weblet::Response> L<HTTP::Request>, L<Catalyst::Request>
=head1 LICENSE
View
2  lib/Piglet/Request/BodyParser.pm → lib/HTTPx/Weblet/Request/BodyParser.pm
@@ -1,4 +1,4 @@
-package Piglet::Request::BodyParser;
+package HTTPx::Weblet::Request::BodyParser;
use strict;
use warnings;
BEGIN { require Carp }; # do not call Carp->import for performance
View
4 lib/Piglet/Request/Upload.pm → lib/HTTPx/Weblet/Request/Upload.pm
@@ -1,4 +1,4 @@
-package Piglet::Request::Upload;
+package HTTPx::Weblet::Request::Upload;
use strict;
use warnings;
BEGIN { require Carp }; # do not call Carp->import for performance
@@ -82,7 +82,7 @@ __END__
=head1 NAME
-Piglet::Request::Upload - handles file upload requests
+HTTPx::Weblet::Request::Upload - handles file upload requests
=head1 METHODS
View
22 lib/Piglet/Response.pm → lib/HTTPx/Weblet/Response.pm
@@ -1,4 +1,4 @@
-package Piglet::Response;
+package HTTPx::Weblet::Response;
use strict;
use warnings;
our $VERSION = '0.01';
@@ -140,16 +140,16 @@ __END__
=head1 NAME
-Piglet::Response - Portable HTTP Response object for PSGI response
+HTTPx::Weblet::Response - Portable HTTP Response object for PSGI response
=head1 SYNOPSIS
- use Piglet::Response;
+ use HTTPx::Weblet::Response;
sub psgi_handler {
my $env = shift;
- my $res = Piglet::Response->new(200);
+ my $res = HTTPx::Weblet::Response->new(200);
$res->content_type('text/html');
$res->body("Hello World");
@@ -158,7 +158,7 @@ Piglet::Response - Portable HTTP Response object for PSGI response
=head1 DESCRIPTION
-Piglet::Response allows you a way to create PSGI response array ref through a simple API.
+HTTPx::Weblet::Response allows you a way to create PSGI response array ref through a simple API.
=head1 METHODS
@@ -166,12 +166,12 @@ Piglet::Response allows you a way to create PSGI response array ref through a si
=item new
- $res = Piglet::Response->new;
- $res = Piglet::Response->new($status);
- $res = Piglet::Response->new($status, $headers);
- $res = Piglet::Response->new($status, $headers, $body);
+ $res = HTTPx::Weblet::Response->new;
+ $res = HTTPx::Weblet::Response->new($status);
+ $res = HTTPx::Weblet::Response->new($status, $headers);
+ $res = HTTPx::Weblet::Response->new($status, $headers, $body);
-Creates a new Piglet::Response object.
+Creates a new HTTPx::Weblet::Response object.
=item status
@@ -243,7 +243,7 @@ Tokuhiro Matsuno
=head1 SEE ALSO
-L<Piglet::Request>
+L<HTTPx::Weblet::Request>
=head1 LICENSE
View
2  t/00_compile.t
@@ -1,4 +1,4 @@
use strict;
use Test::More tests => 1;
-BEGIN { use_ok 'Piglet::Request' }
+BEGIN { use_ok 'HTTPx::Weblet::Request' }
View
0  t/Piglet-Request/body.t → t/Request/body.t
File renamed without changes
View
0  t/Piglet-Request/content.t → t/Request/content.t
File renamed without changes
View
0  t/Piglet-Request/cookie.t → t/Request/cookie.t
File renamed without changes
View
4 t/Piglet-Request/double_port.t → t/Request/double_port.t
@@ -1,13 +1,13 @@
use Test::More;
use Test::Requires qw(Plack::Test);
use Plack::Test;
-use Piglet::Request;
+use HTTPx::Weblet::Request;
use HTTP::Request::Common;
$Plack::Test::Impl = 'Server';
my $app = sub {
- my $req = Piglet::Request->new(shift);
+ my $req = HTTPx::Weblet::Request->new(shift);
return [200, [], [ $req->uri ]];
};
View
0  t/Piglet-Request/hostname.t → t/Request/hostname.t
File renamed without changes
View
0  t/Piglet-Request/many_upload.t → t/Request/many_upload.t
File renamed without changes
View
6 t/Piglet-Request/new.t → t/Request/new.t
@@ -1,8 +1,8 @@
use strict;
use Test::More;
-use Piglet::Request;
+use HTTPx::Weblet::Request;
-my $req = Piglet::Request->new(+{
+my $req = HTTPx::Weblet::Request->new(+{
REQUEST_METHOD => 'GET',
SERVER_PROTOCOL => 'HTTP/1.1',
SERVER_PORT => 80,
@@ -15,7 +15,7 @@ my $req = Piglet::Request->new(+{
'psgi.url_scheme' => 'http',
});
-isa_ok($req, 'Piglet::Request');
+isa_ok($req, 'HTTPx::Weblet::Request');
is($req->address, '127.0.0.1', 'address');
is($req->method, 'GET', 'method');
View
0  t/Piglet-Request/parameters.t → t/Request/parameters.t
File renamed without changes
View
0  t/Piglet-Request/params.t → t/Request/params.t
File renamed without changes
View
4 t/Piglet-Request/path_info.t → t/Request/path_info.t
@@ -2,11 +2,11 @@ use strict;
use Test::More;
use Test::Requires qw(Plack::Test Plack::App::URLMap);
use Plack::Test;
-use Piglet::Request;
+use HTTPx::Weblet::Request;
use HTTP::Request::Common;
my $path_app = sub {
- my $req = Piglet::Request->new(shift);
+ my $req = HTTPx::Weblet::Request->new(shift);
my $res = $req->new_response(200);
$res->content_type('text/plain');
$res->content($req->path_info);
View
0  t/Piglet-Request/raw_body.t → t/Request/raw_body.t
File renamed without changes
View
4 t/Piglet-Request/raw_uri.t → t/Request/raw_uri.t
@@ -1,13 +1,13 @@
use strict;
use Test::Requires qw(HTTP::Message::PSGI);
use Test::More;
-use Piglet::Request;
+use HTTPx::Weblet::Request;
use HTTP::Request::Common;
my $raw_uri;
my $app = sub {
- my $req = Piglet::Request->new(shift);
+ my $req = HTTPx::Weblet::Request->new(shift);
$raw_uri = $req->raw_uri;
};
View
0  t/Piglet-Request/readbody.t → t/Request/readbody.t
File renamed without changes
View
4 t/Piglet-Request/upload-basename.t → t/Request/upload-basename.t
@@ -1,9 +1,9 @@
use strict;
use warnings;
use Test::More tests => 1;
-use Piglet::Request::Upload;
+use HTTPx::Weblet::Request::Upload;
-my $upload = Piglet::Request::Upload->new(
+my $upload = HTTPx::Weblet::Request::Upload->new(
filename => '/tmp/foo/bar/hoge.txt',
);
is $upload->basename, 'hoge.txt';
View
16 t/Piglet-Request/upload.t → t/Request/upload.t
@@ -2,7 +2,7 @@ use strict;
use warnings;
use Test::More tests => 15;
-use Piglet::Request::Upload;
+use HTTPx::Weblet::Request::Upload;
use t::Utils;
my $req = req(
@@ -12,13 +12,13 @@ my $req = req(
);
# file1
-$req->upload(foo => Piglet::Request::Upload->new(filename => 'foo1.txt'));
-is ref($req->upload('foo')), 'Piglet::Request::Upload';
+$req->upload(foo => HTTPx::Weblet::Request::Upload->new(filename => 'foo1.txt'));
+is ref($req->upload('foo')), 'HTTPx::Weblet::Request::Upload';
is $req->upload('foo')->filename, 'foo1.txt';
# file2
-$req->upload(foo => Piglet::Request::Upload->new(filename => 'foo2.txt'));
-is ref($req->upload('foo')), 'Piglet::Request::Upload';
+$req->upload(foo => HTTPx::Weblet::Request::Upload->new(filename => 'foo2.txt'));
+is ref($req->upload('foo')), 'HTTPx::Weblet::Request::Upload';
is $req->upload('foo')->filename, 'foo1.txt';
my @files = $req->upload('foo');
is scalar(@files), 2;
@@ -26,8 +26,8 @@ is $files[0]->filename, 'foo1.txt';
is $files[1]->filename, 'foo2.txt';
# file3
-$req->upload(foo => Piglet::Request::Upload->new(filename => 'foo3.txt'));
-is ref($req->upload('foo')), 'Piglet::Request::Upload';
+$req->upload(foo => HTTPx::Weblet::Request::Upload->new(filename => 'foo3.txt'));
+is ref($req->upload('foo')), 'HTTPx::Weblet::Request::Upload';
is $req->upload('foo')->filename, 'foo1.txt';
my @files2 = $req->upload('foo');
is scalar(@files2), 3;
@@ -37,6 +37,6 @@ is $files2[2]->filename, 'foo3.txt';
# no arguments
is join(', ', $req->upload()), 'foo';
-$req->upload(bar => Piglet::Request::Upload->new(filename => 'bar1.txt'));
+$req->upload(bar => HTTPx::Weblet::Request::Upload->new(filename => 'bar1.txt'));
is join(', ', sort { $a cmp $b } $req->upload()), 'bar, foo';
View
0  t/Piglet-Request/uri.t → t/Request/uri.t
File renamed without changes
View
4 t/Piglet-Response/body.t → t/Response/body.t
@@ -2,11 +2,11 @@ use strict;
use warnings;
use FindBin;
use Test::More;
-use Piglet::Response;
+use HTTPx::Weblet::Response;
use URI;
sub r($) {
- my $res = Piglet::Response->new(200);
+ my $res = HTTPx::Weblet::Response->new(200);
$res->body(@_);
return $res->finalize->[2];
}
View
12 t/Piglet-Response/new.t → t/Response/new.t
@@ -1,32 +1,32 @@
use strict;
use warnings;
use Test::More;
-use Piglet::Response;
+use HTTPx::Weblet::Response;
{
- my $res = Piglet::Response->new(302);
+ my $res = HTTPx::Weblet::Response->new(302);
is $res->status, 302;
is $res->code, 302;
}
{
- my $res = Piglet::Response->new(200, [ 'Content-Type' => 'text/plain' ]);
+ my $res = HTTPx::Weblet::Response->new(200, [ 'Content-Type' => 'text/plain' ]);
is $res->content_type, 'text/plain';
}
{
- my $res = Piglet::Response->new(200, { 'Content-Type' => 'text/plain' });
+ my $res = HTTPx::Weblet::Response->new(200, { 'Content-Type' => 'text/plain' });
is $res->content_type, 'text/plain';
}
{
- my $res = Piglet::Response->new(200);
+ my $res = HTTPx::Weblet::Response->new(200);
$res->content_type('image/png');
is $res->content_type, 'image/png';
}
{
- my $res = Piglet::Response->new(200);
+ my $res = HTTPx::Weblet::Response->new(200);
$res->header('X-Foo' => "bar");
is $res->header('X-Foo'), "bar";
}
View
6 t/Piglet-Response/redirect.t → t/Response/redirect.t
@@ -1,10 +1,10 @@
use strict;
use warnings;
use Test::More;
-use Piglet::Response;
+use HTTPx::Weblet::Response;
{
- my $res = Piglet::Response->new;
+ my $res = HTTPx::Weblet::Response->new;
$res->redirect('http://www.google.com/');
is $res->location, 'http://www.google.com/';
is $res->code, 302;
@@ -13,7 +13,7 @@ use Piglet::Response;
}
{
- my $res = Piglet::Response->new;
+ my $res = HTTPx::Weblet::Response->new;
$res->redirect('http://www.google.com/', 301);
is_deeply $res->finalize, [ 301, [ 'Location' => 'http://www.google.com/' ], [] ];
}
View
4 t/Piglet-Response/response.t → t/Response/response.t
@@ -1,10 +1,10 @@
use strict;
use warnings;
use Test::More;
-use Piglet::Response;
+use HTTPx::Weblet::Response;
sub res {
- my $res = Piglet::Response->new;
+ my $res = HTTPx::Weblet::Response->new;
my %v = @_;
while (my($k, $v) = each %v) {
$res->$k($v);
View
4 t/Utils.pm
@@ -1,7 +1,7 @@
package t::Utils;
use strict;
use warnings;
-use Piglet::Request;
+use HTTPx::Weblet::Request;
use base qw/Exporter/;
@@ -19,7 +19,7 @@ sub req {
SERVER_PORT => 80,
%args
};
- Piglet::Request->new($env);
+ HTTPx::Weblet::Request->new($env);
}
1;
Please sign in to comment.
Something went wrong with that request. Please try again.