> On 29 May 2017, at 8:55 am, iaw4 <[email protected]> wrote:
>
> thanks, heiko. my site relies heavily on proper handling many host
> subdomains. for example, my auth subdomain handles OAuth intereactions
> with google, which are subdomain specific. and then each of my users has
> their own vanity subdomain, but they nicely share session information. once
> logged into one subdomain, they can go to another. so, for my case, the
> usual testing just within sites (get_ok('/')) is insufficient. I really do
> need to work with full http:// and URLs to obtain the subdomain and make
> different decisions based on it. I guess my app is unusual :-(.
To do this, take the decision logic (which parses the hostname), and make it
testable. For instance, make it check an environment variable first:
my $domain;
if ($ENV{OVERRIDE_DOMAIN}) {
$domain = $ENV{OVERRIDE_DOMAIN};
}
else {
$domain = $self->req.., # normal logic
}
Then you can go back to using the built in testing idioms, and simply set the
environment variable where appropriate.
Cheers,
Justin
--
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.