X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2b374566a4a6e9d5dc532c2a8e4ffecaa4f0d719..73e1bfac301b9285f734374abe84d8146897c585:/services/api/app/controllers/application_controller.rb diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb index 348ed13d53..434b09572b 100644 --- a/services/api/app/controllers/application_controller.rb +++ b/services/api/app/controllers/application_controller.rb @@ -83,7 +83,8 @@ class ApplicationController < ActionController::Base else errors = [e.inspect] end - render json: { errors: errors }, status: 422 + status = e.respond_to?(:http_status) ? e.http_status : 422 + render json: { errors: errors }, status: status end def render_not_found(e=ActionController::RoutingError.new("Path not found")) @@ -354,4 +355,9 @@ class ApplicationController < ActionController::Base order: { type: 'string', required: false } } end + + def client_accepts_plain_text_stream + (request.headers['Accept'].split(' ') & + ['text/plain', '*/*']).count > 0 + end end