PATCH fixes #1961 Adding JSONP support

New version of the patch.

בתאריך יום רביעי, 21 בנובמבר 2012 09:17:23 UTC+2, מאת Oved Ourfali:

0001-fixes-1961-Adding-JSONP-support.patch (2.75 KB)

··· > > When using cross-domain requests, it is impossible to read the response > data, and process it. > Using JSONP allows a client, from a specific domain (for example > /domain1), to query data in another doamin (/domain2), and analyze it, > using a callback. > > Such a request would be followed by "callback=" parameter. For example: > http://foreman-server:3000/statistics?format=json&callback=analyzeStats > > And the response would be: > analyzeStats({"statistics":{"mem_totfree":0.0,"arch_count":{}, > "env_count":{},"cpu_count":{},"mem_size":0,"swap_size":0, > "model_count":{},"mem_free":0,"swap_free":0,"klass_count":{}, > "os_count":{},"mem_totsize":0.0}}) > > which will call the analyzeStats callback. > Whereas a regular request, > http://foreman-server:3000/statistics?format=json, will just contain the > JSON data. > > More reading on JSONP: > JSONP - http://en.wikipedia.org/wiki/JSONP > JSONP Ruby impl - > www.simb.net/2012/02/06/ruby-and-jsonp > https://github.com/crohr/rack-jsonp/ >