Json indeed :)

On 16 Apr 2012, at 15:44, Jonathan Lundell wrote:

> On Apr 16, 2012, at 6:24 AM, Massimo Di Pierro wrote:
>> Because IE browsers, when they receive a error page (HTTP x!=200) and the 
>> content is less than a certain size, they choose to ignore the content and 
>> display an uninformative canned message instead. web2py injects in the 
>> content an html comment to make it just long enough so that IE browser do 
>> not ignore the comment. This is important for example so that IE displays 
>> web2py tickets instead of a generic error page.
> 
> Except that this is a JSON request, not HTML.
> 
>> 
>> On Monday, 16 April 2012 07:24:46 UTC-5, Joseph.Piron wrote:
>> Hi gents !
>> 
>> I was working on an extjs client intended to discuss with web2py when I 
>> stumbled upon this weird behaviour:
>> 
>> with my client calling "PUT /defaut/api/alarms/1.json", I want the server to 
>> respond a 409 error code with good json return {success: false, errors: 
>> {...}}
>> and use raise HTTP(409, {"success":False, "errors":{...}}) to generate this 
>> error.
>> Unfortunately, even if the call has been done with a ".json", the 
>> content-type header of the response is set to "text/html" and thus, the code 
>> adds a 
>> <!-- 
>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>>  //-->
>> 
>> at the end for a 4xx code (not for a 5xx code, which works for me).
>> Shouldn't the content-type be set to text/json or something similar ?
>> 
>> Thanks for your support !
> 
> 

Reply via email to