it **should** work.

response.headers = yourdictholdingheaders
raise HTTP(status, body)

On Thursday, March 7, 2013 4:41:31 AM UTC+1, Alec Taylor wrote:
>
> Okay, got it to work; but it's rather messy: 
>
> raise HTTP(*msg[0:2], **msg[3]) 
>
> On Thu, Mar 7, 2013 at 1:47 PM, Alec Taylor 
> <[email protected]<javascript:>> 
> wrote: 
> > My attempt: 
> > 
> > msg = (403, json.dumps({"state": "", "error_message": None, "error": 
> > "unauthorized_client"}), None, {'Content-Type': 'application/json'}) 
> > 
> > raise HTTP(*msg) 
> > 
> > What I get back: 
> > 
> > < HTTP/1.1 403 FORBIDDEN 
> > < Content-Length: 68 
> > < Content-Type: text/html; charset=UTF-8 
> > < Date: Thu, 07 Mar 2013 02:45:08 GMT 
> > < Server: Rocket 1.2.6 Python/2.7.3 
> > < Connection: keep-alive 
> > < 
> > {"state": "", "error_message": null, "error": "unauthorized_client"} 
> > 
> > 
> > 
> > Should also note that I get that same header content-type back when I 
> > access the URL with .json when the controllers are decorated with 
> > `@service.json`. 
> > 
> > How do I include headers in gluon.http.HTTP exceptions? 
> > 
> > Thanks for all suggestions, 
> > 
> > Alec Taylor 
>

-- 

--- 
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.


Reply via email to