angularjs_json_middleware: Rack middleware for AngularJS JSON vulnerability protection.
Prepend AngularJS JSON vulnerability protection string ")]}',\n" to all JSON responses. See https://docs.angularjs.org/api/ng/service/$http.
Requirements
Rack
Installation
Gemfile
Add to your Gemfile:
gem 'angularjs_json_middleware'Or lock it to the current backwards compatible version:
gem 'angularjs_json_middleware', '~> 0.0.1'Config
Add the middleware to the stack.
For general use add it to your config.ru.
use AngularjsJsonMiddlewareFor rails add it to config/application.rb.
class Application < Rails::Application
...
config.middleware.use AngularjsJsonMiddleware
...
endLicense
The MIT License (MIT)