4 use Test::More tests => 7;
7 use_ok('Catalyst::Request');
9 my $request = Catalyst::Request->new( {
10 uri => URI->new('http://127.0.0.1/foo/bar/baz')
14 $request->uri_with({}),
15 'http://127.0.0.1/foo/bar/baz',
16 'URI for absolute path'
20 $request->uri_with({ foo => 'bar' }),
21 'http://127.0.0.1/foo/bar/baz?foo=bar',
25 my $request2 = Catalyst::Request->new( {
26 uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
29 $request2->uri_with({}),
30 'http://127.0.0.1/foo/bar/baz?bar=gorch',
35 $request2->uri_with({ me => 'awesome' }),
36 'http://127.0.0.1/foo/bar/baz?bar=gorch&me=awesome',
37 'URI retains param and adds new'
41 $request2->uri_with({ bar => undef }),
42 'http://127.0.0.1/foo/bar/baz',
43 'URI loses param when explicitly undef'
47 $request2->uri_with({ bar => 'snort' }),
48 'http://127.0.0.1/foo/bar/baz?bar=snort',