Sha256: 3a393514b922a83d2c20d2dc9ec6d371c29b91928c4179fe0b6d65e082542a95

Contents?: true

Size: 396 Bytes

Versions: 7

Compression:

Stored size: 396 Bytes

Contents

API_JSON = 'application/vnd.api+json'.freeze

Mime::Type.register(API_JSON, :jsonapi)

parsers = ActionDispatch::Request.parameter_parsers.merge(
  Mime[:jsonapi].symbol => ->(body) { JSON.parse(body) }
)
ActionDispatch::Request.parameter_parsers = parsers

ActionController::Renderers.add :jsonapi do |obj, _options|
  self.content_type ||= Mime[:jsonapi]
  self.response_body = obj.to_json
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.17.0 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.0 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.2 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.3 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.6 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.4 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb
disco_app-0.18.1 lib/generators/disco_app/react/templates/config/initializers/mime_types.rb