Commit 1d2c98186014cedc01f04382d507a34a71008ab1

Authored by Nihad Abbasov
1 parent 0d67f209

return errors in json format

Showing 2 changed files with 2 additions and 1 deletions   Show diff stats
lib/api.rb
... ... @@ -3,6 +3,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
3 3 module Gitlab
4 4 class API < Grape::API
5 5 format :json
  6 + error_format :json
6 7 helpers APIHelpers
7 8  
8 9 mount Users
... ...
lib/api/helpers.rb
... ... @@ -5,7 +5,7 @@ module Gitlab
5 5 end
6 6  
7 7 def authenticate!
8   - error!('401 Unauthorized', 401) unless current_user
  8 + error!({'message' => '401 Unauthorized'}, 401) unless current_user
9 9 end
10 10 end
11 11 end
... ...