Re: [pylons-discuss] Convert Response to HTTP, and a JSON error response

2019-01-11 Thread Arndt Droullier
Am Fr., 11. Jan. 2019 um 05:57 Uhr schrieb Mike Orr : > Is there a simple way to convert a Response to an HTTP string; i.e., > with headers and a body like it would send to the client? > > I have a JSON backend view that sends an HTTP exception like this: > > # HTTP 422, simulating a validation er

Re: [pylons-discuss] Convert Response to HTTP, and a JSON error response

2019-01-11 Thread Michael Merickel
Your frontend that's making the ajax call is likely not configuring the accept header appropriately to prefer application/json content. On Thu, Jan 10, 2019 at 10:57 PM Mike Orr wrote: > Is there a simple way to convert a Response to an HTTP string; i.e., > with headers and a body like it would

[pylons-discuss] Convert Response to HTTP, and a JSON error response

2019-01-10 Thread Mike Orr
Is there a simple way to convert a Response to an HTTP string; i.e., with headers and a body like it would send to the client? I have a JSON backend view that sends an HTTP exception like this: # HTTP 422, simulating a validation error jreq = {"email": "m...@example.com", "errors": {"email": "Tes