Any suggestions on how to force the response to ASCII instead of UFT-8? /dps
On Tuesday, November 22, 2016 at 11:36:27 PM UTC-8, Dave S wrote: > > > > On Thursday, November 17, 2016 at 11:09:27 PM UTC-8, Dave S wrote: >> >> >> >> On Thursday, November 17, 2016 at 2:38:57 PM UTC-8, Niphlod wrote: >>> >>> if the request comes in either as a POST or as a PUT it has a body >>> (since all examples report a faily nested query structure, I'd say it's the >>> case vs a simple querystring in a GET) >>> >>> If the body carries the correct content-encoding, it's automatically >>> parsed into request.vars. You can still read the raw body as usual in >>> request.body . >>> >>> >> Thanks, that helped me to know what to look for. I got the Grafana stuff >> installed, it does the fake-json-source ok, and with FF developer tools >> I'm seeing the traffic to my nascent endpoint. >> >> When configuring the datasource URL, it does a GET to the base URL (the >> one just for "checking in", return an HTTP 200; I put a little status json >> into the response body just for grins). When you configure a panel (the >> youtube videos they provide are important here) and select a metric , it >> will do an OPTIONS and then a POST. >> >> I had put some CORS headers into my response, because FF is seeing me >> return data when it accesses the Gravana server. [Sidebar question: does >> the book cover anything about valid CORS? I didn't find it if it's there; >> fortunately, there were some good posts in the GG archive. The book does >> have little bits about providing protection against against black-hat >> CORS.] The request to me seems to come from the client JS -- since it >> shows in the network panel -- but FF gives CORS errors if I don't have the >> headers. >> >> So now I just have to make a good response to the metric requests. >> >> /dps >> >> > I may have to force the response to ASCII, and I don't remember how to do > that. My JSON is currently being decoded as 36 or so objects, each a > single character, while the fake source response is being decoded as a > single compound object (per the FF devtool network tab), and the Grafana > display is saying "datapoints is undefined". > > My content header line says "application/json;encoding/utf-8", theirs > says only "application/json". > > /dps > > >>> >>> On Tuesday, November 15, 2016 at 10:50:23 PM UTC+1, Dave S wrote: >>>> >>>> I'm trying to implement a simple json endpoint for Grafana. Does >>>> anyone here have experience with doing this? >>>> >>>> <URL: >>>> https://github.com/grafana/simple-json-datasource/blob/master/README.md >>>> > >>>> >>>> I'm looking at using @service.json, but I'm not sure how to get the >>>> body on a /query. >>>> >>>> (The sample fake-simple-json-datasource is a server written in >>>> javascript! It doesn't make clear if the /query is a POST or a GET, and >>>> if >>>> it's a GET how the body gets done.) >>>> >>>> /dps >>>> >>>> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.