Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 30 lines (25 sloc) 0.969 kb
1d9d2b8 @tadzik Organize stuff
authored
1 class Bailador::Request {
a64fbc3 @tadzik Make Bailador::Request mutable
authored
2 has $.env is rw;
1d9d2b8 @tadzik Organize stuff
authored
3
4 method params {
5 my %ret;
6 for $.env<psgi.input>.split('&') -> $p {
7 my $pair = $p.split('=');
8 %ret{$pair[0]} = $pair[1];
9 }
10 return %ret;
11 }
12
13 method port { $.env<SERVER_PORT> }
14 method request_uri { $.env<REQUEST_URI> }
15 method uri { self.request_uri }
16 method path { $.env<PATH_INFO> }
17
18 method method { $.env<REQUEST_METHOD> }
19 method is_get { self.method eq 'GET' }
20 method is_post { self.method eq 'POST' }
21 method is_put { self.method eq 'PUT' }
22 method is_delete { self.method eq 'DELETE' }
23 method is_head { self.method eq 'HEAD' }
24 method is_patch { self.method eq 'PATCH' }
25
26 method content_type { $.env<CONTENT_TYPE> }
27 method content_length { $.env<CONTENT_LENGTH> }
28 method body { $.env<psgi.input> }
29 }
Something went wrong with that request. Please try again.