Re: [Mojolicious] JSON is rendered twice

2015-02-16 Thread Stefan Adams
On Mon, Feb 16, 2015 at 7:11 AM, Magnificent Core 
wrote:

> Using render(json => ...) doesn't work fine for Cyrillic symbols, that's
> why I use data => .


It renders only once for me
.  I also loaded it
in a web browser and it renders only once there as well.

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] JSON is rendered twice

2015-02-16 Thread Magnificent Core
Using render(json => ...) doesn't work fine for Cyrillic symbols, that's 
why I use data => . 

On Monday, February 16, 2015 at 4:01:52 PM UTC+3, John wrote:
>
>
> On 02/16/2015 06:36 AM, Magnificent Core wrote: 
> > Hi all. 
> > 
> > I've noticed, that when json is rendered, sometimes it's rendered 
> > actually twice. 
> > 
> > Here's the code I have: 
> > get '/test' => sub { 
> > my $self =shift; 
> > $self->render(data => encode_json {'a' => 'b'}); 
> > }; 
>
> I bet the render and encode_json are doing something similar. 
>
> Try this: 
>
> $self->render(json => { a => 'b' } ); 
>
> See docs for this render option. 
>
> John 
>
>

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] JSON is rendered twice

2015-02-16 Thread John


On 02/16/2015 06:36 AM, Magnificent Core wrote:

Hi all.

I've noticed, that when json is rendered, sometimes it's rendered 
actually twice.


Here's the code I have:
get '/test' => sub {
my $self =shift;
$self->render(data => encode_json {'a' => 'b'});
};


I bet the render and encode_json are doing something similar.

Try this:

$self->render(json => { a => 'b' } );

See docs for this render option.

John

--
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] JSON is rendered twice

2015-02-16 Thread Magnificent Core
Hi all.

I've noticed, that when json is rendered, sometimes it's rendered actually 
twice.

Here's the code I have:
get '/test' => sub {
my $self =shift;
$self->render(data => encode_json {'a' => 'b'});
};

So, when I open in browser http://mysite.com/test I see the following in 
debug console:

[Mon Feb 16 15:00:22 2015] [debug] GET "/test"
[Mon Feb 16 15:00:22 2015] [debug] Routing to a callback
[Mon Feb 16 15:00:22 2015] [debug] 200 OK (0.001468s, 681.199/s)
[Mon Feb 16 15:00:23 2015] [debug] GET "/test"
[Mon Feb 16 15:00:23 2015] [debug] Routing to a callback
[Mon Feb 16 15:00:23 2015] [debug] 200 OK (0.000599s, 1669.449/s)

When I render text or html template, pages are rendered only once.

Does somebody know what may be the problem?

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.