response.write but for files with correct content-type?

Viewed 1877

Is there a way to return a file (ex. images, scripts) with correct content type with response.write? This is what I have been using:

with open(path) as f:
    self.response.write(f.read())

but this sets the content type as text/html. Or is response.write not the correct way to approach this?

2 Answers
Related