Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv22428/lib/HTTP/WebTest/Plugin
Modified Files:
SetRequest.pm
Log Message:
Support for relative_urls parameter
Index: SetRequest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** SetRequest.pm 23 Aug 2002 10:42:15 -0000 1.16
--- SetRequest.pm 24 Sep 2002 21:12:06 -0000 1.17
***************
*** 26,33 ****
=for pod_merge copy params
=head2 url
! URL to test. If schema part of URL is omitted (i.e. URL doesn't start
! with C<http://>, C<ftp://>, etc) then C<http://> is implied.
=head2 method
--- 26,54 ----
=for pod_merge copy params
+ =head2 relative_urls
+
+ If set to C<yes> than C<HTTP-WebTest> supports relative URLs. See
+ test parameter C<url> for more information.
+
+ =head3 Allowed values
+
+ C<yes>, C<no>
+
+ =head3 Default value
+
+ C<no>
+
=head2 url
! URL to test.
!
! If test parameter C<relative_urls> is set to C<yes> than URL for each
! test is treated as relative to the URL in the previous test. URL in
! the first test is treated as relative to C<http://localhost>.
!
! If test parameter C<relative_urls> is set to C<no> than each URL is
! treated as absolute. In this case if schema part of URL is omitted
! (i.e. URL doesn't start with C<http://>, C<ftp://>, etc) then
! C<http://> is implied.
=head2 method
***************
*** 166,169 ****
--- 187,191 ----
sub param_types {
return q(url uri
+ relative_urls yesno
method scalar('^(?:GET|POST)$')
params hashlist
***************
*** 185,189 ****
my $request = $self->webtest->last_request;
! $self->validate_params(qw(url method params
auth proxies pauth
http_headers user_agent));
--- 207,211 ----
my $request = $self->webtest->last_request;
! $self->validate_params(qw(url relative_urls method params
auth proxies pauth
http_headers user_agent));
***************
*** 191,194 ****
--- 213,217 ----
# get various params we handle
my $url = $self->test_param('url');
+ my $relative_urls = $self->yesno_test_param('relative_urls');
my $method = $self->test_param('method');
my $params = $self->test_param('params');
***************
*** 200,206 ****
my $handle_redirects = $self->yesno_test_param('handle_redirects', 1);
- # fix broken url
if(defined $url) {
! $url = "http://" . $url unless $url =~ m|^\w+://|;
}
--- 223,239 ----
my $handle_redirects = $self->yesno_test_param('handle_redirects', 1);
if(defined $url) {
! if($relative_urls) {
! my $last_test_num = $self->webtest->last_test_num;
!
! my $prev_url = $last_test_num > 0 ?
! $self->webtest->tests->[$last_test_num - 1]->request->uri :
! 'http://localhost/';
!
! $url = URI->new_abs($url, $prev_url);
! } else {
! # add shema part if it is missing
! $url = "http://" . $url unless $url =~ m|^\w+://|;
! }
}
|