Skip to content

Commit 3b4efbc

Browse files
sjohnstonsimbabque
authored andcommitted
add wrapper method for delete requests
Just like the methods for get, put, etc, this add the base to relative URLs.
1 parent adf8508 commit 3b4efbc

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/WWW/Mechanize.pm

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,25 @@ sub head {
552552
return $self->SUPER::head( $uri->as_string, @_ );
553553
}
554554

555+
=head2 $mech->delete ($uri )
556+
557+
Performs a DELETE request to C<$uri>. Returns an L<HTTP::Response> object.
558+
C<$uri> can be a well-formed URI string, a L<URI> object, or a
559+
L<WWW::Mechanize::Link> object.
560+
561+
=cut
562+
563+
sub delete {
564+
my $self = shift;
565+
my $uri = shift;
566+
567+
$uri = $self->_uri_with_base( $uri );
568+
569+
# It appears we are returning a super-class method,
570+
# but it in turn calls the request() method here in Mechanize
571+
return $self->SUPER::delete( $uri->as_string, @_ );
572+
}
573+
555574
sub _uri_with_base {
556575
my $self = shift;
557576
my $uri = shift;

0 commit comments

Comments
 (0)