From 6ace5414429c96b9a11bf7d13ceb12a8a624725a Mon Sep 17 00:00:00 2001 From: "Robert (Jamie) Munro" Date: Sun, 13 May 2007 14:06:55 +0000 Subject: [PATCH] Made way controller return text/xml instead of text/html. Fixes #450 Also fixed some line endings and trailing spaces. --- app/controllers/way_controller.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index d297f0acc..559438207 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -1,10 +1,11 @@ -class WayController < ApplicationController +class WayController < ApplicationController require 'xml/libxml' before_filter :authorize after_filter :compress_output - + def create + response.headers["Content-Type"] = 'text/xml' if request.put? way = Way.from_xml(request.raw_post, true) @@ -32,7 +33,7 @@ class WayController < ApplicationController render :nothing => true, :status => 500 # something went very wrong end - def full + def full unless Way.exists?(params[:id]) render :nothing => true, :status => 404 return @@ -68,12 +69,14 @@ class WayController < ApplicationController end def rest + response.headers["Content-Type"] = 'text/xml' unless Way.exists?(params[:id]) render :nothing => true, :status => 404 return end way = Way.find(params[:id]) + case request.method when :get @@ -128,7 +131,7 @@ class WayController < ApplicationController doc = OSM::API.new.get_xml_doc waylist.each do |way| doc.root << way.to_xml_node - end + end render :text => doc.to_s else render :nothing => true, :status => 400 -- 2.39.5