Sha256: e5439b2f37f47057df6f9a3f55d83f41ab2c86fd65522699577e182c06936ada
Contents?: true
Size: 553 Bytes
Versions: 20
Compression:
Stored size: 553 Bytes
Contents
# encoding: utf-8 module Hyperdrive module Middleware class ContentNegotiation def initialize(app) @app = app end def call(env) accept = env['hyperdrive.accept'] acceptable_content_types = env['hyperdrive.resource'].acceptable_content_types(env['REQUEST_METHOD']) env['hyperdrive.media_type'] = accept.best_of(acceptable_content_types) raise Hyperdrive::Errors::NotAcceptable.new(env['HTTP_ACCEPT']) unless env['hyperdrive.media_type'] @app.call(env) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems