FYI: I get:

Content-Type: application/json

When I have: `response.view = 'generic.json'`, e.g.: on a `@request.restful()`

On just a regular GET request on a `@service.json` endpoint I get:

Content-Type: text/html; charset=UTF-8

And with a POST that has its args given with `-d` curl arg I get:

Content-Type: application/x-www-form-urlencoded

With reply (same reply whether containing .json in URL or not):

Content-Type: text/html; charset=UTF-8

On Wed, Mar 6, 2013 at 10:15 PM, Alec Taylor <alec.tayl...@gmail.com> wrote:
> 401 was actually the error code that would be relevant there.
>
> Surprised that the XML comments were removed in 2.4.2; had been
> tracing the commits. Just checked and noticed I am on 02.21.10.15.58
> and it was fixed in 02.22.18.44.48 >.<
>
> Thanks for the other tips; should be helpful :D
>
> On Wed, Mar 6, 2013 at 9:57 PM, Ricardo Pedroso <rmdpedr...@gmail.com> wrote:
>> On Wed, Mar 6, 2013 at 9:43 AM, Alec Taylor <alec.tayl...@gmail.com> 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 web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>

-- 

--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to