Sha256: c6a9b5a751474bc1e190510bef20bf2519737c252b49d0e32d17a6ffbe996121

Contents?: true

Size: 574 Bytes

Versions: 44

Compression:

Stored size: 574 Bytes

Contents

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

44 entries across 44 versions & 1 rubygems

Version Path
utopia-2.11.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.11.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.10.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.9.5 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.9.3 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.9.2 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.9.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.9.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.8.2 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.8.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.8.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.7.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.6.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.5.5 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.5.4 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.5.3 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.5.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.5.0 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.4.1 spec/utopia/controller/respond_spec/errors/controller.rb
utopia-2.4.0 spec/utopia/controller/respond_spec/errors/controller.rb