content-type

26 views
Skip to first unread message

pelle

unread,
Jul 17, 2008, 5:01:29 PM7/17/08
to Google App Engine
Hi.

I'm trying to return an SVG image, which works fine using the
following code when
I test it at home using the SDK:

def respond(self, data, type="text/html"):
self.response.headers.add_header("Content-Type", type)
self.response.out.write(data)
...
self.respond(svg, "image/svg+xml")

However, when running the same code on the Google server it returns
the image as text/html instead.
That header is not in the list of Disallowed HTTP Response Headers
anyway. Perhaps there is a better
way to set the content-type?

pelle

unread,
Jul 17, 2008, 5:25:01 PM7/17/08
to Google App Engine
Aw, sorry. I figured it out. It turned out locally with the SDK the
wrong content-type was returned as well, but for some
reason my web browser figured out it was a SVG anyway. Weird. The
solution was to use this instead to set the type:

self.response.headers["Content-Type"] = type
Reply all
Reply to author
Forward
0 new messages