Re: [Mojolicious] Render http status code + json ?

2018-08-28 Thread Luc Larochelle
thank u so much for the confirmation. Btw I tried to replicate as per your 
example in the meanwhile and it works perfectly for me.

Best,
Luc

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


Re: [Mojolicious] Render http status code + json ?

2018-08-28 Thread Stefan Adams
On Tue, Aug 28, 2018 at 8:47 AM Luc Larochelle 
wrote:

> What I mean is, how can I pass both types to the renderer ?
>
> $c->render(status => 404, json => {message => 'error'});
>
> Is that the proper way ?
>

Yep!  And FWIW, "Every ojo one-liner is also a Mojolicious::Lite
application. "  Therefore,
technically, the solution I presented meets your requirements.  :)  I just
put the Mojolicious::Lite app into a ojo one liner for brevity in showing
code and output!

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


Re: [Mojolicious] Render http status code + json ?

2018-08-28 Thread Luc Larochelle
What I mean is, how can I pass both types to the renderer ?

$c->render(status => 404, json => {message => 'error'}); 

Is that the proper way ? 


On Tuesday, 28 August 2018 09:29:03 UTC-4, Luc Larochelle wrote:
>
> well that's interesting for sure , but actually I'm using Mojolicious::Lite

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


Re: [Mojolicious] Render http status code + json ?

2018-08-28 Thread Luc Larochelle
well that's interesting for sure , but actually I'm using Mojolicious::Lite

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


Re: [Mojolicious] Render http status code + json ?

2018-08-27 Thread Stefan Adams
On Mon, Aug 27, 2018 at 9:39 PM Luc Larochelle 
wrote:

> Hi, what's the proper way to render a status code and a json message at
> the same time ?
>

*$ perl -Mojo -E 'a("/" => {status => 404, json => {error => "not
found"}})->start' get -v /*
GET / HTTP/1.1
User-Agent: Mojolicious (Perl)
Content-Length: 0
Host: 127.0.0.1:41463
Accept-Encoding: gzip

*HTTP/1.1 404 Not Found*
Server: Mojolicious (Perl)
Content-Type: application/json;charset=UTF-8
Content-Length: 21
Date: Tue, 28 Aug 2018 02:46:28 GMT

*{"error":"not found"}*

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