-#!perl\r
+\feff#!perl\r
\r
use strict;\r
use warnings;\r
use FindBin;\r
use lib "$FindBin::Bin/lib";\r
\r
-use Test::More tests => 23;\r
+use Test::More tests => 41;\r
use Catalyst::Test 'TestApp';\r
use Catalyst::Request;\r
\r
is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' );\r
is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' );\r
}\r
+\r
+# test that uri_with adds params\r
+{\r
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with'), 'Request' );\r
+ ok( $response->is_success, 'Response Successful 2xx' );\r
+ ok( !defined $response->header( 'X-Catalyst-Param-a' ), 'param "a" ok' );\r
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );\r
+}\r
+\r
+# test that uri_with adds params (and preserves)\r
+{\r
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1'), 'Request' );\r
+ ok( $response->is_success, 'Response Successful 2xx' );\r
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );\r
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );\r
+}\r
+\r
+# test that uri_with replaces params (and preserves)\r
+{\r
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2'), 'Request' );\r
+ ok( $response->is_success, 'Response Successful 2xx' );\r
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );\r
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );\r
+}\r
+\r
+# test that uri_with replaces params (and preserves)\r
+{\r
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with_object'), 'Request' );\r
+ ok( $response->is_success, 'Response Successful 2xx' );\r
+ is( $response->header( 'X-Catalyst-Param-a' ), 'http://localhost/', 'param "a" ok' );\r
+}\r
+\r
+# test that uri_with is utf8 safe\r
+{\r
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_utf8"), 'Request' );\r
+ ok( $response->is_success, 'Response Successful 2xx' );\r
+ like( $response->header( 'X-Catalyst-uri-with' ), qr/%E2%98%A0$/, 'uri_with ok' );\r
+}\r