return errors in json format

This commit is contained in:
Nihad Abbasov 2012-06-29 03:52:20 -07:00
parent 0d67f209fc
commit 1d2c981860
2 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ Dir["#{Rails.root}/lib/api/*.rb"].each {|file| require file}
module Gitlab
class API < Grape::API
format :json
error_format :json
helpers APIHelpers
mount Users

View File

@ -5,7 +5,7 @@ module Gitlab
end
def authenticate!
error!('401 Unauthorized', 401) unless current_user
error!({'message' => '401 Unauthorized'}, 401) unless current_user
end
end
end