summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 75e3f1f..140cc25 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -18,8 +18,13 @@ end
# Get a feature
get "/feature/:id/?" do
- feature = Feature.find :id => params[:id]
- resource_not_found_error "Feature with id: #{params[:id]} not found." unless feature
- feature[:URI] = uri("/feature/#{feature.id}")
- return feature.to_json
-end \ No newline at end of file
+ case @accept
+ when "application/json"
+ feature = Feature.find :id => params[:id]
+ not_found_error "Feature with id: #{params[:id]} not found." unless feature
+ feature[:URI] = uri("/feature/#{feature.id}")
+ return feature.to_json
+ else
+ bad_request_error "Mime type #{@accept} is not supported."
+ end
+end