summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Helma <helma@in-silico.de>2010-02-19 14:31:39 +0100
committerChristoph Helma <helma@in-silico.de>2010-02-19 14:31:39 +0100
commite639230dcbd34319784c76d3317525984bdd0595 (patch)
tree62a7777376a222ee4cb1fc96b7f2348619d3606b
parentcc8861c7de416248010cbc11cef3a67579fb60b2 (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 1b1a255..2b9870e 100644
--- a/application.rb
+++ b/application.rb
@@ -20,16 +20,19 @@ end
DataMapper.auto_upgrade!
get '/?' do
+ response['Content-Type'] = 'text/uri-list'
Task.all.collect{|t| t.uri}.join("\n")
end
get '/:id/?' do
+ response['Content-Type'] = 'application/x-yaml'
task = Task.get(params[:id])
task.to_yaml
end
# dynamic access to Task properties
get '/:id/:property/?' do
+ response['Content-Type'] = 'text/plain'
task = Task.get(params[:id])
eval("task.#{params[:property]}").to_s
end
@@ -40,6 +43,7 @@ post '/?' do
task.save # needed to create id
task.uri = url_for("/#{task.id}", :full)
task.save
+ response['Content-Type'] = 'text/uri-list'
task.uri
end
@@ -71,6 +75,7 @@ delete '/:id/?' do
"Cannot kill task with pid #{task.pid}"
end
task.destroy!
+ response['Content-Type'] = 'text/plain'
"Task #{params[:id]} deleted."
end
@@ -81,7 +86,9 @@ delete '/?' do
rescue
"Cannot kill task with pid #{task.pid}"
end
- task.destroy!
+ #task.destroy!
end
+ Task.auto_migrate!
+ response['Content-Type'] = 'text/plain'
"All tasks deleted."
end