Sha256: 57cb88b6491e678c7d526c47e144fa3eddddf02b7a21f77ac3c0d2ce84f83c37
Contents?: true
Size: 1.76 KB
Versions: 4
Compression:
Stored size: 1.76 KB
Contents
class SetHeader def initialize(app, header, value) @app = app @header = header @value = value end def call(env) status, headers, body = @app.call(env) headers[@header] = @value [status, headers,body] end end Praxis::Application.configure do |application| application.handler 'xml', Praxis::Handlers::XML application.middleware SetHeader, 'Spec-Middleware', 'used' application.bootloader.use SimpleAuthenticationPlugin, config_file: 'config/authentication.yml' application.bootloader.use AuthorizationPlugin application.bootloader.use Praxis::Plugins::PraxisMapperPlugin, { config_data: { repositories: { default: {adapter: 'sqlite', database: ':memory:'} } } } # enable "development-mode" options application.config.praxis.validate_responses = true application.config.praxis.validate_response_bodies = true application.config.praxis.show_exceptions = true # FIXME: until we have a better way to unit test such a feature... # Silly callback code pieces to test that the deferred callbacks work even for sub-stages application.bootloader.after :app, :models do PersonModel.identity(:other_id) end application.bootloader.after :app do raise "After sub-stage hooks not working!" unless PersonModel.identities.include? :other_id end application.layout do layout do map :initializers, 'config/initializers/**/*' map :design, 'design/' do map :api, 'api.rb' map :media_types, '**/media_types/**/*' map :resources, '**/resources/**/*' end map :app, 'app/' do map :models, 'models/**/*' map :concerns, '**/concerns/**/*' map :controllers, '**/controllers/**/*' map :responses, '**/responses/**/*' end end end end
Version data entries
4 entries across 4 versions & 1 rubygems