Solved. Create new Test::Mojo object and subscribe to event start for ua.
my $tt = Test::Mojo->new('Mojo::Twist');
> $tt->ua->max_redirects(2);
> $tt->ua->on(start => sub {
> my ($ua, $tx) = @_;
>
> $tx->req->headers->referrer('http://127.0.0.1:'.$ua->server->{nb_port}.'/page/user');
> });
> $tt->post_ok( '/api')
> ->status_is(200)
> ->json_like(qr/.../);
пятница, 8 августа 2014 г., 0:18:08 UTC+4 пользователь Александр Грошев
написал:
>
> I need to set ...->headers->header(Refferer) in test for app.
> How I can do that in Mojo::Test?
>
> t->post_ok( '/api' => {Referrer => '/page/user'} ... failed on this line,
> but Mojo::UserAgent in documentation use that method for set headers to
> websocet request.
>
--
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.