return errors in json format
This commit is contained in:
parent
0d67f209fc
commit
1d2c981860
2 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
|
||||||
module Gitlab
|
module Gitlab
|
||||||
class API < Grape::API
|
class API < Grape::API
|
||||||
format :json
|
format :json
|
||||||
|
error_format :json
|
||||||
helpers APIHelpers
|
helpers APIHelpers
|
||||||
|
|
||||||
mount Users
|
mount Users
|
||||||
|
|
|
@ -5,7 +5,7 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def authenticate!
|
def authenticate!
|
||||||
error!('401 Unauthorized', 401) unless current_user
|
error!({'message' => '401 Unauthorized'}, 401) unless current_user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue