Skip to content

Commit 2f738e9

Browse files
Copilotoalders
authored andcommitted
Fix form.t to work with HTTP::Message 7.01+
Co-authored-by: oalders <[email protected]> Bump HTTP::Request version from 6 to 7.01 and update tests to reflect the new requirement Update Changes
1 parent 365e9ea commit 2f738e9

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Change history for HTML-Form
22

33
{{$NEXT}}
4+
- Fix form.t compatibility with HTTP::Message 7.01+ (GH#57) (Copilot and
5+
Gianni Ceccarelli)
46

57
6.12 2024-10-18 16:19:06Z
68
- Fix CRLF normalization with HTTP::Message 7.00 (GH#53) (Graham Knop)

dist.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ user = libwww-perl
3636

3737
[Prereqs]
3838
Encode = 2
39-
HTTP::Request = 6
39+
HTTP::Request = 7.01
4040
HTTP::Request::Common = 6.03
4141
perl = 5.008001
4242
Test::More = 0.96

t/form.t

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,14 @@ EOT
8383
#print $f->dump;
8484
#print $f->click->as_string;
8585

86-
is( $f->click->as_string, <<'EOT');
86+
chomp(my $expected_advanced = <<'EOT');
8787
POST http://localhost/
8888
Content-Length: 86
8989
Content-Type: application/x-www-form-urlencoded
9090
9191
i.x=1&i.y=1&c=on&r=b&t=&p=&tel=&date=&h=xyzzy&f=&x=&a=%0D%0Aabc%0D%0A+++&s=bar&m=a&m=b
9292
EOT
93+
is( $f->click->as_string, $expected_advanced);
9394

9495
is( @warn, 1 );
9596
like( $warn[0], qr/^Unknown input type 'xyzzy'/ );
@@ -463,22 +464,24 @@ EOT
463464
ok( $f->find_input("randomkey") );
464465
is( $f->find_input("randomkey")->challenge, "1234567890" );
465466
is( $f->find_input("randomkey")->keytype, "rsa" );
466-
is( $f->click->as_string, <<EOT);
467+
chomp(my $expected_keygen = <<EOT);
467468
POST http://example.com/secure/keygen/test.cgi
468469
Content-Length: 19
469470
Content-Type: application/x-www-form-urlencoded
470471
471472
Field1=Default+Text
472473
EOT
474+
is( $f->click->as_string, $expected_keygen);
473475

474476
$f->value( randomkey => "foo" );
475-
is( $f->click->as_string, <<EOT);
477+
chomp(my $expected_keygen_foo = <<EOT);
476478
POST http://example.com/secure/keygen/test.cgi
477479
Content-Length: 33
478480
Content-Type: application/x-www-form-urlencoded
479481
480482
randomkey=foo&Field1=Default+Text
481483
EOT
484+
is( $f->click->as_string, $expected_keygen_foo);
482485

483486
$f = HTML::Form->parse( <<EOT, "http://www.example.com" );
484487
<form ACTION="http://example.com/">
@@ -602,13 +605,14 @@ $f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
602605
</form>
603606
EOT
604607

605-
is( $f->click->as_string, <<EOT);
608+
chomp(my $expected_button_go = <<EOT);
606609
POST http://localhost/
607610
Content-Length: 9
608611
Content-Type: application/x-www-form-urlencoded
609612
610613
submit=go
611614
EOT
615+
is( $f->click->as_string, $expected_button_go);
612616

613617
$f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
614618
<form method=post>
@@ -617,13 +621,14 @@ $f = HTML::Form->parse( <<EOT, base => "http://localhost/" );
617621
</form>
618622
EOT
619623

620-
is( $f->click->as_string, <<EOT);
624+
chomp(my $expected_button_empty = <<EOT);
621625
POST http://localhost/
622626
Content-Length: 7
623627
Content-Type: application/x-www-form-urlencoded
624628
625629
submit=
626630
EOT
631+
is( $f->click->as_string, $expected_button_empty);
627632

628633
# select with a name followed by select without a name GH#2
629634
$f = HTML::Form->parse( <<EOT, "http://localhost/" );
@@ -674,4 +679,4 @@ GET http://localhost/target.html?foo=option+in+named
674679
EOT
675680
}
676681

677-
done_testing;
682+
done_testing;

0 commit comments

Comments
 (0)