@@ -12,34 +12,34 @@ use Test::More;
1212{
1313 my $req = GET(' /' );
1414 my ($res , $c ) = ctx_request($req );
15- ok ($res -> code == RC_OK, ' response ok' );
15+ is ($res -> code, RC_OK, ' response ok' );
1616 is($res -> content, ' index' , ' content ok' );
1717}
1818{
1919 my $req = POST(' /' , [foo => ' bar' ]);
2020 my ($res , $c ) = ctx_request($req );
21- ok ($res -> code == RC_OK, ' response ok' );
21+ is ($res -> code, RC_OK, ' response ok' );
2222 is($c -> req-> param(' foo' ), ' bar' , ' Normal POST body param, nothing to strip, left alone' );
2323}
2424{
2525 my $req = POST(' /' , [foo => ' bar<script>alert("0");</script>' ]);
2626 my ($res , $c ) = ctx_request($req );
27- ok ($res -> code == RC_OK, ' response ok' );
27+ is ($res -> code, RC_OK, ' response ok' );
2828 is($c -> req-> param(' foo' ), ' bar' , ' XSS stripped from normal POST body param' );
2929}
3030{
3131 # we allow <b> in the test app config so this should not be stripped
3232 my $req = POST(' /' , [foo => ' <b>bar</b>' ]);
3333 my ($res , $c ) = ctx_request($req );
34- ok ($res -> code == RC_OK, ' response ok' );
34+ is ($res -> code, RC_OK, ' response ok' );
3535 is($c -> req-> param(' foo' ), ' <b>bar</b>' , ' Allowed tag not stripped' );
3636}
3737{
3838 diag " HTML left alone in ignored field - by regex match" ;
3939 my $value = ' <h1>Bar</h1><p>Foo</p>' ;
4040 my $req = POST(' /' , [foo_html => $value ]);
4141 my ($res , $c ) = ctx_request($req );
42- ok ($res -> code == RC_OK, ' response ok' );
42+ is ($res -> code, RC_OK, ' response ok' );
4343 is(
4444 $c -> req-> param(' foo_html' ),
4545 $value ,
@@ -50,8 +50,10 @@ use Test::More;
5050 diag " HTML left alone in ignored field - by name" ;
5151 my $value = ' <h1>Bar</h1><p>Foo</p>' ;
5252 my $req = POST(' /' , [ignored_param => $value ]);
53+ diag " *** REQ: $req " ;
54+ diag $req -> as_string;
5355 my ($res , $c ) = ctx_request($req );
54- ok ($res -> code == RC_OK, ' response ok' );
56+ is ($res -> code, RC_OK, ' response ok' );
5557 is(
5658 $c -> req-> param(' ignored_param' ),
5759 $value ,
7880 Content_Type => ' application/json' , Content => $json_body
7981 );
8082 my ($res , $c ) = ctx_request($req );
81- ok ($res -> code == RC_OK, ' response ok' );
83+ is ($res -> code, RC_OK, ' response ok' );
8284 is(
8385 $c -> req-> body_data-> {foo },
8486 ' Top-level ' , # note trailing space where img was removed
0 commit comments