Good catch. Can you check trunk?
On Sep 2, 7:02 pm, Jonathan Lundell <jlund...@pobox.com> wrote: > On Sep 2, 2011, at 3:45 PM, Stefaan Himpe wrote: > > >> Is this coming through generic.json? > > > I created a simple web application from scratch, only added this code in > > the controller (I think web2py has support for both json and jsonrpc? i'm > > using jsonrpc here): > > It looks to me as if Service.serve_jsonrpc is simply not setting > Content-type, so it defaults to text/html. > > You might try modifying serve_jsonrpc (use serve_json as an example) to set > Content-type properly. It's in gluon.tools. > > > > > > > > > > > @service.jsonrpc > > def add(x,y): > > return x+y > > > Now, I post a json request over http to add numbers 5 and 6 to > > 'http://127.0.0.1:5000/simple_json_server/default/call/jsonrpc', > > and I get back a reply with the following header contents: > > > [ http_version(1-1), > > status(ok,'OK'), > > x_powered_by(web2py), > > set_cookie(set_cookie(session_id_simple_json_server, > > '127.0.0.1-abd8ad25-61f4-4a62-bb59-9f64c7ba065a', > > [path= (/)])), > > expires('Fri, 02 Sep 2011 22:40:47 GMT'), > > pragma('no-cache'), > > cache_control('no-store, no-cache, must-revalidate, post-check=0, > > pre-check=0'), > > content_type('text/html; charset=utf-8'), > > date('Fri, 02 Sep 2011 22:40:47 GMT'), > > server('Rocket 1.2.2 Python/2.6.7'), > > content_length(56), > > connection('keep-alive') > > ] > > > The rest of the request then contains the json reply containing the correct > > answer. > > > Please let me know if you need more data. > > > Best regards, > > Stefaan.