@@ -476,11 +476,7 @@ sub get {
476
476
my $self = shift ;
477
477
my $uri = shift ;
478
478
479
- $uri = $uri -> url if ref ($uri ) eq ' WWW::Mechanize::Link' ;
480
-
481
- $uri = $self -> base
482
- ? URI-> new_abs( $uri , $self -> base )
483
- : URI-> new( $uri );
479
+ $uri = $self -> _uri_with_base( $uri );
484
480
485
481
# It appears we are returning a super-class method,
486
482
# but it in turn calls the request() method here in Mechanize
@@ -499,11 +495,7 @@ sub post {
499
495
my $self = shift ;
500
496
my $uri = shift ;
501
497
502
- $uri = $uri -> url if ref ($uri ) eq ' WWW::Mechanize::Link' ;
503
-
504
- $uri = $self -> base
505
- ? URI-> new_abs( $uri , $self -> base )
506
- : URI-> new( $uri );
498
+ $uri = $self -> _uri_with_base( $uri );
507
499
508
500
# It appears we are returning a super-class method,
509
501
# but it in turn calls the request() method here in Mechanize
@@ -525,11 +517,7 @@ sub put {
525
517
my $self = shift ;
526
518
my $uri = shift ;
527
519
528
- $uri = $uri -> url if ref ($uri ) eq ' WWW::Mechanize::Link' ;
529
-
530
- $uri = $self -> base
531
- ? URI-> new_abs( $uri , $self -> base )
532
- : URI-> new( $uri );
520
+ $uri = $self -> _uri_with_base( $uri );
533
521
534
522
# It appears we are returning a super-class method,
535
523
# but it in turn calls the request() method here in Mechanize
@@ -557,15 +545,24 @@ sub head {
557
545
my $self = shift ;
558
546
my $uri = shift ;
559
547
548
+ $uri = $self -> _uri_with_base( $uri );
549
+
550
+ # It appears we are returning a super-class method,
551
+ # but it in turn calls the request() method here in Mechanize
552
+ return $self -> SUPER::head( $uri -> as_string, @_ );
553
+ }
554
+
555
+ sub _uri_with_base {
556
+ my $self = shift ;
557
+ my $uri = shift ;
558
+
560
559
$uri = $uri -> url if ref ($uri ) eq ' WWW::Mechanize::Link' ;
561
560
562
561
$uri = $self -> base
563
562
? URI-> new_abs( $uri , $self -> base )
564
563
: URI-> new( $uri );
565
564
566
- # It appears we are returning a super-class method,
567
- # but it in turn calls the request() method here in Mechanize
568
- return $self -> SUPER::head( $uri -> as_string, @_ );
565
+ return $uri ;
569
566
}
570
567
571
568
=head2 $mech->reload()
0 commit comments