On 31/03/14 06:11, Chung WONG wrote:
For example, there is a view returns a http exception to a request:
    @view_config(route_name='route', renderer='json', request_method='GET')
     def view(request):
*        return HTTPUnprocessableEntity(detail='details',
comment='comment', body_template='body_template')*

it returned a full html page
        *<html>*
        *<head>*
        *<title>422 Unprocessable Entity</title>*
        *</head>*
        *<body>*
        *<h1>422 Unprocessable Entity</h1>*
        *body_template*
        *</body>*
        *</html>*


is it possible to make the return as a JSON so that the frontend can
extract the error message easily?

thanks

Try setting the corresponding content_type in the Response object: application/json

Mariano

--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pylons-discuss.
For more options, visit https://groups.google.com/d/optout.

Reply via email to