Render strings as text/plain

This commit is contained in:
Piotr Sarnacki 2014-04-08 15:06:48 +02:00
parent c1db39610e
commit a926ac1945

View File

@ -10,18 +10,22 @@ module Travis::Api::App::Responders
# for log's content for now.
#
# TODO: think how to handle other formats correctly
super && resource.is_a?(Log)
super && (resource.is_a?(Log) || resource.is_a?(String))
end
def apply
super
if resource.is_a?(Log)
filename = resource.id
disposition = params[:attachment] ? 'attachment' : 'inline'
headers['Content-Disposition'] = %(#{disposition}; filename="#{filename}")
params[:deansi] ? clear_ansi(resource.content) : resource.content
else
resource
end
end
private