Google App Content Content-Type HTTP Application Header Invalid After Application Deployment

I am writing an application in GAE, and I have a URL that will always return XML and set the Content-Type to "text/xml; charset=utf-8".

I use the built-in webapp framework and using the following code to set the content type and return the XML to the web page handler:

self.response.headers.add_header('Content-Type',"text/xml; charset=utf-8")
self.response.out.write(template.render("my_xml",{"key1":"val1"}))

This works fine in a local development environment, but as soon as I deploy Google servers, the content type is always set to "text/html; charset=utf-8".

How can I make sure the correct one is Content-Typeinstalled after launching on Google servers?

+5
source share
1 answer

self.response.headers['Content-Type'] = "text/xml; charset=utf-8", , .

+19

All Articles