RestServer
RestServer copied to clipboard
Callback support for JSONP
Absolutely love this. Fantastic for playing around and sketching out APIs.
JSONP support is baked into jQuery and a few other libraries and seems fairly standardised around the notion that if you provide a callback parameter, the server should respond by wrapping the JSON response in that callback function e.g:
/api/mydata/?callback=myfunc
Returns
myfunc(jsondata);
With a text/javascript header rather than application/json
To me it looks like a pretty simple addition but just wondering if it had been considered and rejected for any reason?
No, not rejected. Would love to have it.
I've worked with similar systems that are essentially bi-directonal RPC frameworks (I'm looking at you, XAjax), which can be pretty cool. That said, I'm of the opinion that, since this can be accomplished quite easily using the built-in callback feature in javascript/jQuery, that this would not really add all that much of value for what it is.
As always, though, PRs are welcome.