RestServer icon indicating copy to clipboard operation
RestServer copied to clipboard

Callback support for JSONP

Open Actinity opened this issue 11 years ago • 2 comments

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?

Actinity avatar Mar 12 '13 20:03 Actinity

No, not rejected. Would love to have it.

jacwright avatar Mar 25 '13 17:03 jacwright

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.

tyzoid avatar Jul 18 '17 03:07 tyzoid