Skip Menu |

This queue is for tickets about the Test-WWW-Mechanize-Catalyst CPAN distribution.

Report information
The Basics
Id: 35870
Status: resolved
Priority: 0/
Queue: Test-WWW-Mechanize-Catalyst

People
Owner: Nobody in particular
Requestors: andreas.marienborg [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.42
Fixed in: (no value)



Subject: local requests does not set User-Agent header
Issue: I use $c->req->user_agent in my code. When running local tests with T:W:M::Catalyst, it returns undef, regardless of what I set in the agent when creating my mech-object. Solution: I traced it to a missing call to modify_request in _make_request. Adding that fixes the test, and does not seem to break any of the other tests
Subject: 01.modify_request.diff
diff -urN Test-WWW-Mechanize-Catalyst-0.42.orig/lib/Test/WWW/Mechanize/Catalyst.pm Test-WWW-Mechanize-Catalyst-0.42/lib/Test/WWW/Mechanize/Catalyst.pm --- Test-WWW-Mechanize-Catalyst-0.42.orig/lib/Test/WWW/Mechanize/Catalyst.pm 2008-05-13 15:08:47.000000000 +0200 +++ Test-WWW-Mechanize-Catalyst-0.42/lib/Test/WWW/Mechanize/Catalyst.pm 2008-05-13 16:07:27.000000000 +0200 @@ -37,6 +37,7 @@ if LWP::UserAgent->get_basic_credentials( undef, "Basic", $request->uri ); + $request = $self->prepare_request($request); my $response = Test::WWW::Mechanize::Catalyst::Aux::request($request); $response->header( 'Content-Base', $request->uri ); $response->request($request); diff -urN Test-WWW-Mechanize-Catalyst-0.42.orig/t/lib/Catty.pm Test-WWW-Mechanize-Catalyst-0.42/t/lib/Catty.pm --- Test-WWW-Mechanize-Catalyst-0.42.orig/t/lib/Catty.pm 2008-05-13 15:08:47.000000000 +0200 +++ Test-WWW-Mechanize-Catalyst-0.42/t/lib/Catty.pm 2008-05-13 15:10:34.000000000 +0200 @@ -108,5 +108,14 @@ $c->response->headers->push_header( 'Vary', 'Accept-Encoding' ); } +sub user_agent : Global { + my ( $self, $c ) = @_; + + my $html = html($c->req->user_agent, $c->req->user_agent); + $c->response->content_type("text/html; charset=utf-8"); + $c->response->output( $html ); + +} + 1; diff -urN Test-WWW-Mechanize-Catalyst-0.42.orig/t/useragent.t Test-WWW-Mechanize-Catalyst-0.42/t/useragent.t --- Test-WWW-Mechanize-Catalyst-0.42.orig/t/useragent.t 1970-01-01 01:00:00.000000000 +0100 +++ Test-WWW-Mechanize-Catalyst-0.42/t/useragent.t 2008-05-13 15:11:35.000000000 +0200 @@ -0,0 +1,15 @@ +#!perl -T +use strict; +use warnings; +use lib 'lib'; +use Encode qw(); +use Test::More tests => 2; +use lib 't/lib'; +use Test::WWW::Mechanize::Catalyst 'Catty'; + +my $root = "http://localhost"; +my $agent = 'TestAgent/1.0'; +my $m = Test::WWW::Mechanize::Catalyst->new(agent => $agent); + +$m->get_ok("$root/user_agent"); +$m->title_is($agent, "title is correct: $agent");
Just applied to SVN - sorry for taking so long, but I've only just taken over maint of this module so enotmyfault. Expect a release in less than a week