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