thanks dotan!
we had assumed that the Test::Mojo ua->server->url would look like
http://localhost:nnn and that was a pretty good guess at the time, but due
to a recent change it's now http://127.0.0.1:nnn
so, a safer way to test cookies in Test::Mojo is to set the cookie domain
(or origin) to $t->ua->server->url->host
this works with all versions
BTW i'm curious what motivated the change from localhost to 127.0.0.1 ... ?
jay
On Saturday, January 3, 2015 4:36:32 AM UTC-5, Dotan Dimet wrote:
>
> Hi Jay,
> You mention you tried changing the value of $domain, but maybe you can see
> what the value really is in the server
> by printing out $t->app->ua->server->url->to_abs
> (or maybe $t->app->url_for('/testGetCookie')->to_abs )
> - Dotan
>
> On 1/3/15, 2:00 AM, jay m wrote:
>
> we have some trivial cookie tests that work in 5.68 (and many other
> versions previously) but not in 5.71
> i didn't see anything relevant in changelog
>
> test code looks like this: ($t is a Test::Mojo instance)
>
> my $domain = 'localhost';
> my $value = 'aabbcc123';
> $t->ua->cookie_jar->add(
> Mojo::Cookie::Response->new(
> name => 'testCookie',
> value => $value,
> domain => $domain,
> path => '/'
> )
> );
>
> $t->get_ok('/testGetCookie')->content_like(qr|value: $value|,'testGetCookie
> from jar');
>
>
> the test controller method just returns "value: " and
> $c->cookie('testCookie') or 'none'. in 5.68 it returns the value, in 5.71
> it returns 'none'. i dumped $c->every_cookie and there are no cookies with
> the correct name. i also tried an all-lowercase cookie name, and tried some
> alternatives to domain => 'localhost' (e.g. the FQDN) with no luck
>
> looks like a problem in the Test::Mojo user agent cookie jar, since i
> can set cookies from other clients, for example
>
> > curl -b testCookie=xyz http://localhost:3023/testGetCookie
> value: xyz
>
> any ideas?
> thanks,
> jay
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at http://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.