[yast-devel] WebYaST: responding XML to an HTML request
Hi, a couple of service controllers return XML to an HTML request. This is usually done as respond_to do |format| format.html { render :xml => ... } #return xml only ... end As coded above, the HTTP reply header reports "text/html" with the reply body containing XML. This is wrong and not RESTful (can we say RESTless ? ;-)) The service should always respond with a resource representation that was requested from the client. If this is not possible, a default representation (i.e. json) should be choosen. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On 15.10.2009 15:28, Klaus Kaempf wrote:
Hi,
a couple of service controllers return XML to an HTML request. This is usually done as
respond_to do |format| format.html { render :xml => ... } #return xml only ... end
As coded above, the HTTP reply header reports "text/html" with the reply body containing XML. This is wrong and not RESTful (can we say RESTless ? ;-))
Um, and what's the correct implementation? Which modules handle that correctly? (i.e. where can I steal the correct code? :-)) -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
* Ladislav Slezak <lslezak@suse.cz> [Oct 15. 2009 15:34]:
On 15.10.2009 15:28, Klaus Kaempf wrote:
Hi,
a couple of service controllers return XML to an HTML request. This is usually done as
respond_to do |format| format.html { render :xml => ... } #return xml only ... end
As coded above, the HTTP reply header reports "text/html" with the reply body containing XML. This is wrong and not RESTful (can we say RESTless ? ;-))
Um, and what's the correct implementation? Which modules handle that correctly? (i.e. where can I steal the correct code? :-))
Just remove the "format.html" line for now. Firefox will happily display XML then. Or provide a real HTML reply (e.g. for debugging purposes) Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Klaus Kaempf
-
Ladislav Slezak