snap-extras icon indicating copy to clipboard operation
snap-extras copied to clipboard

Add by-default CSRF-protection to writeJSON

Open alexanderkjeldaas opened this issue 12 years ago • 2 comments

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

alexanderkjeldaas avatar Feb 20 '13 14:02 alexanderkjeldaas

Actually the commit also includes a writeJSONP function which writes JSONP (content type application/javascript instead of json, and a callback wrapping the json).

alexanderkjeldaas avatar Feb 20 '13 14:02 alexanderkjeldaas

i'd like to see this in snap-extras as well. any objections?

ibotty avatar Feb 12 '14 11:02 ibotty