Commit 3c742dad27d298fae9aa8ee68cf1a83178fb8704

Authored by Dmitriy Zaporozhets
1 parent 87a449f2

Fixed bug with json files content being escaped in api

After update to recent grape env['api.format'] does not work any more.
Use content_type for rendering raw json files content

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing 2 changed files with 3 additions and 3 deletions   Show diff stats
lib/api/api.rb
@@ -22,6 +22,8 @@ module API @@ -22,6 +22,8 @@ module API
22 end 22 end
23 23
24 format :json 24 format :json
  25 + content_type :txt, "text/plain"
  26 +
25 helpers APIHelpers 27 helpers APIHelpers
26 28
27 mount Groups 29 mount Groups
lib/api/repositories.rb
@@ -167,9 +167,7 @@ module API @@ -167,9 +167,7 @@ module API
167 blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath]) 167 blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath])
168 not_found! "File" unless blob 168 not_found! "File" unless blob
169 169
170 - env['api.format'] = :txt  
171 -  
172 - content_type blob.mime_type 170 + content_type 'text/plain'
173 present blob.data 171 present blob.data
174 end 172 end
175 173