my app redirects to http://auth.localhost:3000/index , and from there to 
'/auth/authenticator' , which is where it stays---all of which are under 
the full control of the app itself.  (different users get different vanity 
domains.) . so, here is my stripped example:

#!/usr/bin/env perl
use Mojolicious::Lite;

my $s = sub {
  my $c= shift;
  ( ($c->req->url->to_abs->host()) =~ /auth/) and return $c->redirect_to(
'/auth/index');
  $c->redirect_to('http://auth.localhost:3000/index');
};

get "/index" => $s;
get "/" => $s;
get "/auth/index" => sub {
  my $c= shift;
  return $c->render( text => 'we have arrived in /auth/index' );
};

app->start();


and

#!/usr/bin/env perl
use Test::More;
use Test::Mojo;

my $SylSpace= 'http://localhost:3000';

my $t = Test::Mojo->new;
$t->ua->max_redirects(100);
$t->get_ok($SylSpace.'/')->status_is(200); # ->content_like( qr{abc});

done_testing();


and the output is
# Connection refused
not ok 1 - GET http://localhost:3000/
#   Failed test 'GET http://localhost:3000/'
#   at redirect.t line 9.
not ok 2 - 200 OK
#   Failed test '200 OK'
#   at redirect.t line 9.
#          got: undef
#     expected: '200'
1..2
# Looks like you failed 2 tests of 2.


My browser follows without problems.  I am guessing the Mojo Test daemon 
does not...

regards,

/iaw


On Sunday, May 28, 2017 at 7:10:32 AM UTC-7, Heiko Jansen wrote:
>
> According to the example at https://metacpan.org/pod/Test::Mojo#ua I´d 
> say you´re doing it right.
>
> I wonder, however, how uncommenting that line of code can lead to this 
> error message:
> "Can't connect: nodename nor servname provided, or not known"
>
> - which is apparently not part of Mojolicious itself; cf. 
> https://grep.metacpan.org/search?q=nodename+nor+servname&qd=&qft=
>
> Hmmm, where does the redirect URL point to? Sure that it´s "localhost"?
>
> - heiko
>

-- 
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to