Made way controller return text/xml instead of text/html. Fixes #450
Also fixed some line endings and trailing spaces.
This commit is contained in:
parent
164b05ea96
commit
6ace541442
1 changed files with 7 additions and 4 deletions
|
@ -1,10 +1,11 @@
|
||||||
class WayController < ApplicationController
|
class WayController < ApplicationController
|
||||||
require 'xml/libxml'
|
require 'xml/libxml'
|
||||||
|
|
||||||
before_filter :authorize
|
before_filter :authorize
|
||||||
after_filter :compress_output
|
after_filter :compress_output
|
||||||
|
|
||||||
def create
|
def create
|
||||||
|
response.headers["Content-Type"] = 'text/xml'
|
||||||
if request.put?
|
if request.put?
|
||||||
way = Way.from_xml(request.raw_post, true)
|
way = Way.from_xml(request.raw_post, true)
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ class WayController < ApplicationController
|
||||||
render :nothing => true, :status => 500 # something went very wrong
|
render :nothing => true, :status => 500 # something went very wrong
|
||||||
end
|
end
|
||||||
|
|
||||||
def full
|
def full
|
||||||
unless Way.exists?(params[:id])
|
unless Way.exists?(params[:id])
|
||||||
render :nothing => true, :status => 404
|
render :nothing => true, :status => 404
|
||||||
return
|
return
|
||||||
|
@ -68,12 +69,14 @@ class WayController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def rest
|
def rest
|
||||||
|
response.headers["Content-Type"] = 'text/xml'
|
||||||
unless Way.exists?(params[:id])
|
unless Way.exists?(params[:id])
|
||||||
render :nothing => true, :status => 404
|
render :nothing => true, :status => 404
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
way = Way.find(params[:id])
|
way = Way.find(params[:id])
|
||||||
|
|
||||||
case request.method
|
case request.method
|
||||||
|
|
||||||
when :get
|
when :get
|
||||||
|
@ -128,7 +131,7 @@ class WayController < ApplicationController
|
||||||
doc = OSM::API.new.get_xml_doc
|
doc = OSM::API.new.get_xml_doc
|
||||||
waylist.each do |way|
|
waylist.each do |way|
|
||||||
doc.root << way.to_xml_node
|
doc.root << way.to_xml_node
|
||||||
end
|
end
|
||||||
render :text => doc.to_s
|
render :text => doc.to_s
|
||||||
else
|
else
|
||||||
render :nothing => true, :status => 400
|
render :nothing => true, :status => 400
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue