my $query = '';
+ # remove and save fragment if there is one
+ my $fragment;
+ if ($args =~ s/(#.+)$//) {
+ $fragment = $1;
+ }
+
if (my @keys = keys %$params) {
# somewhat lifted from URI::_query's query_form
$query = '?'.join('&', map {
$base =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
$args = encode_utf8 $args;
$args =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
-
+
+ # re-attach fragment on the end of everything after adding params
+ $query .= $fragment if $fragment;
+
my $res = bless(\"${base}${args}${query}", $class);
$res;
}
'Plus is not encoded'
);
-TODO: {
- local $TODO = 'broken by 5.7008';
- is(
- Catalyst::uri_for( $context, '/bar#fragment', { param1 => 'value1' } )->as_string,
- 'http://127.0.0.1/foo/bar?param1=value1#fragment',
- 'URI for path with fragment and query params'
- );
-}
+is(
+ Catalyst::uri_for( $context, '/bar#fragment', { param1 => 'value1' } )->as_string,
+ 'http://127.0.0.1/foo/bar?param1=value1#fragment',
+ 'URI for path with fragment and query params'
+);
# test with utf-8
is(