Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the PSGI module by default now sets p6sgi instead of psgi #44

Merged
merged 1 commit into from Dec 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
the PSGI module by default now sets p6sgi instead of psgi
  • Loading branch information
krakan committed Dec 6, 2015
commit fe3f1f36f58ce1e1e1066a73449c2dbb2627ba6a
4 changes: 2 additions & 2 deletions lib/Bailador.pm
Expand Up @@ -141,7 +141,7 @@ sub dispatch($env) {
CATCH {
default {
my $env = $app.request.env;
my $err = $env<p6sgi.version>:exists ?? $env<p6sgi.errors> !! $env<psgi.errors>;
my $err = $env<p6sgi.version>:exists ?? $env<p6sgi.errors> !! $env<p6sgi.errors>;
$err.say(.gist);
status 500;
content_type 'text/plain';
Expand All @@ -155,7 +155,7 @@ sub dispatch($env) {
}

our sub dispatch-psgi($env) {
return dispatch($env).psgi;
return dispatch($env).p6sgi;
}

sub baile($port = 3000) is export {
Expand Down
6 changes: 3 additions & 3 deletions lib/Bailador/Request.pm
Expand Up @@ -35,8 +35,8 @@ class Bailador::Request {
}
}
when 'body' {
if $!env<psgi.input> {
for $.env<psgi.input>.decode.split('&') -> $p {
if $!env<p6sgi.input> {
for $.env<p6sgi.input>.decode.split('&') -> $p {
my $pair = $p.split('=', 2);
%ret{$pair[0]} = uri_unescape $pair[1];
}
Expand Down Expand Up @@ -83,5 +83,5 @@ class Bailador::Request {
method content_length { $.env<CONTENT_LENGTH> }

# TODO Shouldn't ignore Content-Type
method body { $.env<psgi.input>.decode }
method body { $.env<p6sgi.input>.decode }
}
18 changes: 9 additions & 9 deletions lib/Bailador/Test.pm
Expand Up @@ -23,15 +23,15 @@ sub get-psgi-response($meth, $url, $data = '') is export {
my $uri = URI.new(($url.substr(0, 1) eq '/' ?? 'http://127.0.0.1:1234' !! '') ~ $url);

my $env = {
"psgi.multiprocess" => Bool::False,
"psgi.multithread" => Bool::False,
"psgi.errors" => IO::Null.new,
"psgi.streaming" => Bool::False,
"psgi.nonblocking" => Bool::False,
"psgi.version" => [1, 0],
"psgi.run_once" => Bool::False,
"psgi.url_scheme" => $uri.scheme,
"psgi.input" => $data.encode('utf-8'),
"p6sgi.multiprocess" => Bool::False,
"p6sgi.multithread" => Bool::False,
"p6sgi.errors" => IO::Null.new,
"p6sgi.streaming" => Bool::False,
"p6sgi.nonblocking" => Bool::False,
"p6sgi.version" => [1, 0],
"p6sgi.run_once" => Bool::False,
"p6sgi.url_scheme" => $uri.scheme,
"p6sgi.input" => $data.encode('utf-8'),
"HTTP_CACHE_CONTROL" => "max-age=0",
"SERVER_PROTOCOL" => "HTTP/1.1",
"HTTP_USER_AGENT" => "Testing",
Expand Down
4 changes: 2 additions & 2 deletions t/05-post-content.t
Expand Up @@ -4,11 +4,11 @@ use Bailador::Test;

plan 3;

post '/foo' => sub { request.env<psgi.input>.decode };
post '/foo' => sub { request.env<p6sgi.input>.decode };

my $data = 'hello=world&a=1;b=2';
my $req = Bailador::Request.new_for_request('POST', '/foo');
$req.env<psgi.input> = $data.encode('utf-8');
$req.env<p6sgi.input> = $data.encode('utf-8');
skip 'fails with precompilation', 3;
#my $resp = Bailador::dispatch_request($req);
#
Expand Down