Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (29 sloc) 1.128 kb
1d9d2b8c »
2011-12-26 Organize stuff
1 class Bailador::Request {
32617119 »
2012-06-23 URLdecode stuff from psgi.input using URI::Escape
2 use URI::Escape;
3
a64fbc3d »
2011-12-27 Make Bailador::Request mutable
4 has $.env is rw;
1d9d2b8c »
2011-12-26 Organize stuff
5
6 method params {
7 my %ret;
8 for $.env<psgi.input>.split('&') -> $p {
9 my $pair = $p.split('=');
32617119 »
2012-06-23 URLdecode stuff from psgi.input using URI::Escape
10 %ret{$pair[0]} = uri_unescape $pair[1];
1d9d2b8c »
2011-12-26 Organize stuff
11 }
12 return %ret;
13 }
14
55fe6122 »
2012-04-07 First cut at Bailador::Test, add some very basic tests too
15 method new_for_request($meth, $path) {
16 self.new: env => { REQUEST_METHOD => $meth, REQUEST_URI => $path}
17 }
18
1d9d2b8c »
2011-12-26 Organize stuff
19 method port { $.env<SERVER_PORT> }
20 method request_uri { $.env<REQUEST_URI> }
21 method uri { self.request_uri }
22 method path { $.env<PATH_INFO> }
23
24 method method { $.env<REQUEST_METHOD> }
25 method is_get { self.method eq 'GET' }
26 method is_post { self.method eq 'POST' }
27 method is_put { self.method eq 'PUT' }
28 method is_delete { self.method eq 'DELETE' }
29 method is_head { self.method eq 'HEAD' }
30 method is_patch { self.method eq 'PATCH' }
31
32 method content_type { $.env<CONTENT_TYPE> }
33 method content_length { $.env<CONTENT_LENGTH> }
34 method body { $.env<psgi.input> }
35 }
Something went wrong with that request. Please try again.