On Wed, Mar 6, 2013 at 9:43 AM, Alec Taylor <[email protected]> wrote:
> Oh, looks like it works on an endpoint level; not sure how to get rid
> of the XML style comment though <!-- -->
>
> Output from curl:
>
>> GET /arbg/error HTTP/1.1
>> Host: localhost
>> Accept: */*
>>
>
> < HTTP/1.1 404 NOT FOUND
> < Set-Cookie: session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d;
> Path=/
> < Content-Length: 555
> < Content-Type: text/html; charset=UTF-8
> < Date: Wed, 06 Mar 2013 09:39:20 GMT
> < Server: Rocket 1.2.6 Python/2.7.3
> < Connection: keep-alive
> <
> {"error": "unauthorized_client"}<!--
> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> //-->
I started using this:
raise HTTP(status, body, None, **{'Content-Type': 'application/json'})
where
status - an HTTP status code (200, 404, 500, ...)
body - a json.dumps("something")
This way I don't need to put a .json extension in the end of url
To get rid of those xxx's you can upgrade to 2.4.2
Note: web2py return a "Content-Type: text/plain; charset=utf-8" when
using a .json extension
I think it for max compatibility.
PS: In your example your are issuing a 404 where a 403 would be a better fit
Ricardo
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.