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>
This commit is contained in:
		
							parent
							
								
									87a449f264
								
							
						
					
					
						commit
						3c742dad27
					
				| 
						 | 
				
			
			@ -22,6 +22,8 @@ module API
 | 
			
		|||
    end
 | 
			
		||||
 | 
			
		||||
    format :json
 | 
			
		||||
    content_type :txt, "text/plain"
 | 
			
		||||
 | 
			
		||||
    helpers APIHelpers
 | 
			
		||||
 | 
			
		||||
    mount Groups
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -167,9 +167,7 @@ module API
 | 
			
		|||
        blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath])
 | 
			
		||||
        not_found! "File" unless blob
 | 
			
		||||
 | 
			
		||||
        env['api.format'] = :txt
 | 
			
		||||
 | 
			
		||||
        content_type blob.mime_type
 | 
			
		||||
        content_type 'text/plain'
 | 
			
		||||
        present blob.data
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue