8 use_ok('Catalyst::Request');
10 my $request = Catalyst::Request->new( {
11 _log => Catalyst::Log->new,
12 uri => URI->new('http://127.0.0.1/foo/bar/baz')
16 $request->uri_with({}),
17 'http://127.0.0.1/foo/bar/baz',
18 'URI for absolute path'
22 $request->uri_with({ foo => 'bar' }),
23 'http://127.0.0.1/foo/bar/baz?foo=bar',
27 my $request2 = Catalyst::Request->new( {
28 _log => Catalyst::Log->new,
29 uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
32 $request2->uri_with({}),
33 'http://127.0.0.1/foo/bar/baz?bar=gorch',
38 $request2->uri_with({ me => 'awesome' }),
39 'http://127.0.0.1/foo/bar/baz?bar=gorch&me=awesome',
40 'URI retains param and adds new'
44 $request2->uri_with({ bar => undef }),
45 'http://127.0.0.1/foo/bar/baz',
46 'URI loses param when explicitly undef'
50 $request2->uri_with({ bar => 'snort' }),
51 'http://127.0.0.1/foo/bar/baz?bar=snort',
56 $request2->uri_with({ bar => [ 'snort', 'ewok' ] }),
57 'http://127.0.0.1/foo/bar/baz?bar=snort&bar=ewok',
58 'overwrite mode URI appends arrayref param'
62 $request2->uri_with({ bar => 'snort' }, { mode => 'append' }),
63 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort',
64 'append mode URI appends param'
68 $request2->uri_with({ bar => [ 'snort', 'ewok' ] }, { mode => 'append' }),
69 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort&bar=ewok',
70 'append mode URI appends arrayref param'