snap-extras
snap-extras copied to clipboard
Add by-default CSRF-protection to writeJSON
Added two extra functions, writeJSONWrapped, and writeJSONUnprotected. The original writeJSON is renamed to writeJSONUnprotected writeJSON prefixes with ")]}',\n" which is stripped away by AngularJS by default. writeJSONWrapped can wrap with a specific wrapper
Actually the commit also includes a writeJSONP function which writes JSONP (content type application/javascript instead of json, and a callback wrapping the json).
i'd like to see this in snap-extras as well. any objections?