@@ -12,34 +12,34 @@ use Test::More;
12
12
{
13
13
my $req = GET(' /' );
14
14
my ($res , $c ) = ctx_request($req );
15
- ok ($res -> code == RC_OK, ' response ok' );
15
+ is ($res -> code, RC_OK, ' response ok' );
16
16
is($res -> content, ' index' , ' content ok' );
17
17
}
18
18
{
19
19
my $req = POST(' /' , [foo => ' bar' ]);
20
20
my ($res , $c ) = ctx_request($req );
21
- ok ($res -> code == RC_OK, ' response ok' );
21
+ is ($res -> code, RC_OK, ' response ok' );
22
22
is($c -> req-> param(' foo' ), ' bar' , ' Normal POST body param, nothing to strip, left alone' );
23
23
}
24
24
{
25
25
my $req = POST(' /' , [foo => ' bar<script>alert("0");</script>' ]);
26
26
my ($res , $c ) = ctx_request($req );
27
- ok ($res -> code == RC_OK, ' response ok' );
27
+ is ($res -> code, RC_OK, ' response ok' );
28
28
is($c -> req-> param(' foo' ), ' bar' , ' XSS stripped from normal POST body param' );
29
29
}
30
30
{
31
31
# we allow <b> in the test app config so this should not be stripped
32
32
my $req = POST(' /' , [foo => ' <b>bar</b>' ]);
33
33
my ($res , $c ) = ctx_request($req );
34
- ok ($res -> code == RC_OK, ' response ok' );
34
+ is ($res -> code, RC_OK, ' response ok' );
35
35
is($c -> req-> param(' foo' ), ' <b>bar</b>' , ' Allowed tag not stripped' );
36
36
}
37
37
{
38
38
diag " HTML left alone in ignored field - by regex match" ;
39
39
my $value = ' <h1>Bar</h1><p>Foo</p>' ;
40
40
my $req = POST(' /' , [foo_html => $value ]);
41
41
my ($res , $c ) = ctx_request($req );
42
- ok ($res -> code == RC_OK, ' response ok' );
42
+ is ($res -> code, RC_OK, ' response ok' );
43
43
is(
44
44
$c -> req-> param(' foo_html' ),
45
45
$value ,
@@ -50,8 +50,10 @@ use Test::More;
50
50
diag " HTML left alone in ignored field - by name" ;
51
51
my $value = ' <h1>Bar</h1><p>Foo</p>' ;
52
52
my $req = POST(' /' , [ignored_param => $value ]);
53
+ diag " *** REQ: $req " ;
54
+ diag $req -> as_string;
53
55
my ($res , $c ) = ctx_request($req );
54
- ok ($res -> code == RC_OK, ' response ok' );
56
+ is ($res -> code, RC_OK, ' response ok' );
55
57
is(
56
58
$c -> req-> param(' ignored_param' ),
57
59
$value ,
78
80
Content_Type => ' application/json' , Content => $json_body
79
81
);
80
82
my ($res , $c ) = ctx_request($req );
81
- ok ($res -> code == RC_OK, ' response ok' );
83
+ is ($res -> code, RC_OK, ' response ok' );
82
84
is(
83
85
$c -> req-> body_data-> {foo },
84
86
' Top-level ' , # note trailing space where img was removed
0 commit comments