Update of /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin
In directory usw-pr-cvs1:/tmp/cvs-serv7011/lib/HTTP/WebTest/Plugin
Modified Files:
SetRequest.pm
Log Message:
Added support for test parameter 'http-headers'
Index: SetRequest.pm
===================================================================
RCS file: /cvsroot/http-webtest/HTTP-WebTest/lib/HTTP/WebTest/Plugin/SetRequest.pm,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** SetRequest.pm 11 May 2002 18:47:09 -0000 1.7
--- SetRequest.pm 12 May 2002 13:36:34 -0000 1.8
***************
*** 28,32 ****
=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.
--- 28,32 ----
=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.
***************
*** 45,56 ****
C<GET>
=head2 params
! A list of name/value pairs to be passed as parameters to the
! URL. (This element is used to test pages that process input from
! forms.) Unless the method key is set to C<POST>, these pairs are
! URI-escaped and appended to the requested URL.
! For example,
url = http://www.hotmail.com/cgi-bin/hmhome
--- 45,67 ----
C<GET>
+ =head2 http_headers
+
+ A list of HTTP header/value pairs. Can be used to override default
+ HTTP headers or to add additional HTTP headers.
+
+ =head3 Example
+
+ http_headers = ( Accept => text/plain, text/html )
+
=head2 params
! A list of name/value pairs to be passed as parameters to the URL.
! (This element is used to test pages that process input from forms.)
! Unless the method key is set to C<POST>, these pairs are URI-escaped
! and appended to the requested URL.
! The names and values will be URI-escaped as defined by RFC 2396.
!
! =head3 Example
url = http://www.hotmail.com/cgi-bin/hmhome
***************
*** 64,69 ****
http://www.hotmail.com/cgi-bin/hmhome?curmbox=F001%20A005&from=HotMail
- The names and values will be URI-escaped as defined by RFC 2396.
-
=head2 auth
--- 75,78 ----
***************
*** 76,80 ****
use for requests.
! For example (C<wtscript> usage):
proxies = ( http => http://http_proxy.mycompany.com
--- 85,89 ----
use for requests.
! =head3 Example
proxies = ( http => http://http_proxy.mycompany.com
***************
*** 100,110 ****
sub param_types {
! return q(url uri
! method scalar('^(?:GET|POST)$')
! params hashlist
! auth list('scalar','scalar')
! proxies hashlist
! pauth list('scalar','scalar')
! user_agent scalar);
}
--- 109,120 ----
sub param_types {
! return q(url uri
! method scalar('^(?:GET|POST)$')
! params hashlist
! auth list('scalar','scalar')
! proxies hashlist
! pauth list('scalar','scalar')
! http_headers hashlist
! user_agent scalar);
}
***************
*** 120,124 ****
$self->validate_params(qw(url method params
auth proxies pauth
! user_agent));
# get various params we handle
--- 130,134 ----
$self->validate_params(qw(url method params
auth proxies pauth
! http_headers user_agent));
# get various params we handle
***************
*** 129,132 ****
--- 139,143 ----
my $proxies = $self->test_param('proxies');
my $pauth = $self->test_param('pauth');
+ my $headers = $self->test_param('http_headers');
my $ua_name = $self->test_param('user_agent');
***************
*** 187,190 ****
--- 198,206 ----
}
+ # set http headers
+ if(defined $headers) {
+ $request->header(@$headers);
+ }
+
# set user agent name
$ua_name = 'HTTP-WebTest/' . HTTP::WebTest->VERSION
***************
*** 195,201 ****
=head1 COPYRIGHT
! Copyright (c) 2000-2001 Richard Anderson. All rights reserved.
! Copyright (c) 2001,2002 Ilya Martynov. All rights reserved.
This module is free software. It may be used, redistributed and/or
--- 211,217 ----
=head1 COPYRIGHT
! Copyright (c) 2000-2001 Richard Anderson. All rights reserved.
! Copyright (c) 2001,2002 Ilya Martynov. All rights reserved.
This module is free software. It may be used, redistributed and/or
|