Sha256: b6272f61ccdb8f9f89db2a57dfdedd0573b9e2405d934ca7edf612ee51b5b8cd

Contents?: true

Size: 604 Bytes

Versions: 13

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

prepend Respond, Actions

# If the request doesn't match application/json specifically, it would be passed through:
respond.with_passthrough
respond.with_json

# The reason why this test is important is that it tests the behaviour of error handling. Normally, if a request comes into the middleware and fails due to an unhandled exception, this is passed along by Utopia::ExceptionHandler. If the client is expecting JSON, they should get a JSON error response.
on 'file-not-found' do
	fail! 404, {message: 'File not found'}
end

# Accept: text/html, application/json, */*

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
utopia-2.15.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.15.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.14.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.13.4 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.13.3 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.13.2 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.13.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.13.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.12.4 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.12.3 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.12.2 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.12.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.12.0 spec/utopia/controller/respond_spec/errors/controller.rb