summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-02-19 14:31:40 +0100
committerChristoph Helma <helma@in-silico.de>2010-02-19 14:31:40 +0100
commit2dcf602090adbc8df84b9ef473d588b050e8ca0c (patch)
treed7c96d1f498e206340518d4dcb471135d36d8d18
parent6fd9a778573582a414318f20bbe95a7c5606b98d (diff)
mime types added to response header
-rw-r--r--application.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/application.rb b/application.rb
index 20f6185..3ec3bba 100644
--- a/application.rb
+++ b/application.rb
@@ -25,6 +25,7 @@ DataMapper.auto_upgrade!
## REST API
get '/?' do
+ response['Content-Type'] = 'text/uri-list'
Dataset.all.collect{|d| d.uri}.join("\n")
end
@@ -40,8 +41,10 @@ get '/:id/?' do
accept = 'application/rdf+xml' if accept == '*/*' or accept == '' or accept.nil?
case accept
when /rdf/ # redland sends text/rdf instead of application/rdf+xml
+ response['Content-Type'] = 'application/rdf+xml'
dataset.owl
when /yaml/
+ response['Content-Type'] = 'application/x-yaml'
OpenTox::Dataset.find(dataset.uri).to_yaml
else
halt 400, "Unsupported MIME type '#{accept}'"
@@ -92,6 +95,7 @@ post '/?' do
end
task.pid = pid
#status 303 # rest client tries to redirect
+ response['Content-Type'] = 'text/uri-list'
task.uri
end
@@ -100,6 +104,7 @@ delete '/:id/?' do
dataset = Dataset.get(params[:id])
File.delete dataset.file
dataset.destroy!
+ response['Content-Type'] = 'text/plain'
"Dataset #{params[:id]} deleted."
rescue
halt 404, "Dataset #{params[:id]} does not exist."
@@ -113,7 +118,9 @@ delete '/?' do
rescue
LOGGER.error "Cannot delete dataset file '#{d.file}'"
end
- d.destroy!
+ #d.destroy!
end
+ Dataset.auto_migrate!
+ response['Content-Type'] = 'text/plain'
"All datasets deleted."
end