[Dancer-users] request and response headers don't match
Puneet Kishor
punk.kish at gmail.com
Mon Dec 27 14:35:43 CET 2010
I am using DP:REST, DS:Mutable, and prepare_serializer_for_format(). I
am querying for a JSON response via jQuery like so
$.ajax({
url : ..,
type : "POST",
data : "poly=" + JSON.stringify(coords_pix),
dataType: "json",
error : function() { alert("Error loading html document"); },
success : function(data) {
.. do stuff with data ..
}
});
This is what I seen in Firebug
Request Headers
===============
..
Accept application/json, text/javascript, */*; q=0.01
..
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Response Headers
================
Date Mon, 27 Dec 2010 13:23:35 GMT
Server Apache/2.2.16 (Unix) DAV/2 mod_perl/2.0.4 Perl/v5.12.1
X-Powered-By Perl Dancer 1.2003
Content-Type text/xml; charset=UTF-8
..
Gak! what happened there? Why did I get back xml even though I requested
json? (Note: It is possible that I don't understand accept and response
headers at all, in which case, kindly educate me).
As a result, Firebug show the JSON output correctly, but complains about
the XML output
XML Parsing Error: not well-formed Location:
moz-nullprincipal:{5063a87c-f476-8346-8452-ab404f4c1282} Line Number 1,
Column 1:
{"harvest_amt":"14188.62","harvest_area":"126100.00","nep":"404789.50"}
^
--
Puneet Kishor http://punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---------------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
===========================================================================
More information about the Dancer-users
mailing list