From b6ad14a839528beab98340beb7942a246a27037d Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 14 Sep 2011 15:32:55 +0200 Subject: fix: list jsonfiles for GET '/' call | prettify json view in html --- application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application.rb b/application.rb index c3520f4..8b42c8c 100644 --- a/application.rb +++ b/application.rb @@ -142,7 +142,7 @@ end # Get a list of available datasets # @return [text/uri-list] List of available datasets get '/?' do - uri_list = Dir["./#{@@datadir}/*yaml"].collect{|f| File.basename(f.sub(/.yaml/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n" + uri_list = Dir["./#{@@datadir}/*json"].collect{|f| File.basename(f.sub(/.json/,'')).to_i}.sort.collect{|n| uri n}.join("\n") + "\n" case @accept when /html/ response['Content-Type'] = 'text/html' @@ -180,7 +180,7 @@ get '/:id' do when /html/ response['Content-Type'] = 'text/html' - OpenTox.text_to_html File.read(@json_file) + OpenTox.text_to_html JSON.pretty_generate(JSON.parse(File.read(@json_file))) when "text/csv" response['Content-Type'] = 'text/csv' -- cgit v1.2.3