Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileResponse has wrong Content-Type header #1224

Closed
wosc opened this issue Jan 17, 2014 · 2 comments
Closed

FileResponse has wrong Content-Type header #1224

wosc opened this issue Jan 17, 2014 · 2 comments

Comments

@wosc
Copy link
Contributor

wosc commented Jan 17, 2014

>>> import pyramid.response
>>> response = pyramid.response.FileResponse('/dev/null', content_type='image/jpeg')
>>> response.headers['Content-Type']
'image/jpeg; charset=UTF-8'

I guess the reason is that FileResponse calls its super __init__ first, which applies the default charset, and since the webob.Response.content_type property preserves parameters if the new value does not contain any, the charset doesn't go away when FileResponse sets the proper content type later on.

@wosc
Copy link
Contributor Author

wosc commented Jan 17, 2014

Hurm. This is actually a bug in webob, it does not apply only to FileResponses, but to normal Responses, too.
I've opened a bug there (Pylons/webob#130), closing here.

@wosc wosc closed this as completed Jan 17, 2014
@dobesv
Copy link
Contributor

dobesv commented Feb 28, 2014

See here for a workaround / solution: #1251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants