Merge branch '1495-crunch-documentation'
[arvados.git] / services / api / app / controllers / application_controller.rb
index 348ed13d534cc7c260529a9c87ce65c100415800..434b09572b40b64af026e27a43962b422aeea7c6 100644 (file)
@@ -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